Upload Foodify-Client
@@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,60 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.waterbase.foodify"
|
||||
minSdk 23
|
||||
targetSdk 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
|
||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
|
||||
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.6.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.5'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
//Add library
|
||||
implementation 'com.google.firebase:firebase-core:10.2.0'
|
||||
implementation 'com.google.firebase:firebase-database:10.2.0'
|
||||
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
|
||||
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
|
||||
|
||||
implementation 'com.squareup.picasso:picasso:2.5.2'
|
||||
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.waterbase.foodify", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.waterbase.foodify">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Foodify"
|
||||
tools:replace="android:theme"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".OrderStatus"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Cart"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".FoodDetail"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".FoodList"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Home"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_home"
|
||||
android:theme="@style/Theme.Foodify.NoActionBar" />
|
||||
<activity
|
||||
android:name=".SignUp"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".SignIn"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Welcome"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.waterbase.foodify.Common.Common;
|
||||
import com.waterbase.foodify.Database.Database;
|
||||
import com.waterbase.foodify.Model.Order;
|
||||
import com.waterbase.foodify.Model.Request;
|
||||
import com.waterbase.foodify.ViewHolder.CartAdapter;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import info.hoang8f.widget.FButton;
|
||||
|
||||
public class Cart extends AppCompatActivity {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
RecyclerView.LayoutManager layoutManager;
|
||||
|
||||
FirebaseDatabase database;
|
||||
DatabaseReference requests;
|
||||
|
||||
TextView txtTotalPrice;
|
||||
FButton btnPlace;
|
||||
|
||||
List<Order> cart = new ArrayList<>();
|
||||
CartAdapter adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_cart);
|
||||
|
||||
//Firebase
|
||||
database = FirebaseDatabase.getInstance();
|
||||
requests = database.getReference("Requests");
|
||||
|
||||
//Init
|
||||
recyclerView = (RecyclerView) findViewById(R.id.listCart);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
txtTotalPrice = (TextView) findViewById(R.id.total);
|
||||
btnPlace = (FButton) findViewById(R.id.btnPlaceOrder);
|
||||
|
||||
btnPlace.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showAlertDialog();
|
||||
}
|
||||
});
|
||||
|
||||
loadListFood();
|
||||
|
||||
setTitle("Giỏ hàng");
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void showAlertDialog() {
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(Cart.this);
|
||||
alertDialog.setTitle("One more step!");
|
||||
alertDialog.setMessage("Enter your address: ");
|
||||
|
||||
final EditText edtAddress = new EditText(Cart.this);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
edtAddress.setLayoutParams(lp);
|
||||
alertDialog.setView(edtAddress); //Add edit text to Dialog
|
||||
alertDialog.setIcon(R.drawable.ic_baseline_shopping_cart_24);
|
||||
|
||||
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//Create new Request
|
||||
Request request = new Request(
|
||||
Common.currentUser.getPhone(),
|
||||
Common.currentUser.getName(),
|
||||
edtAddress.getText().toString(),
|
||||
txtTotalPrice.getText().toString(),
|
||||
cart
|
||||
);
|
||||
|
||||
//Summit to Firebase
|
||||
//We will using System.CurrentMilli to key
|
||||
requests.child(String.valueOf(System.currentTimeMillis())).setValue(request);
|
||||
|
||||
//Delete Cart
|
||||
new Database(getBaseContext()).cleanCart();
|
||||
Toast.makeText(Cart.this, "Đặt hàng thành công!", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
private void loadListFood() {
|
||||
cart = new Database(this).getCarts();
|
||||
adapter = new CartAdapter(cart, this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
//Calculate total price
|
||||
float total = 0;
|
||||
for(Order order:cart)
|
||||
total += (Float.parseFloat(order.getPrice()))*(Float.parseFloat(order.getQuantity()));
|
||||
Locale locale = new Locale("vi", "VN");
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
|
||||
txtTotalPrice.setText(fmt.format(total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.waterbase.foodify.Common;
|
||||
|
||||
import com.waterbase.foodify.Model.User;
|
||||
|
||||
public class Common {
|
||||
public static User currentUser;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.waterbase.foodify.Database;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteQueryBuilder;
|
||||
|
||||
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
|
||||
import com.waterbase.foodify.Model.Order;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Database extends SQLiteAssetHelper {
|
||||
|
||||
private static final String DB_NAME="EatItDB.db";
|
||||
private static final int DB_VER=1;
|
||||
public Database(Context context) {
|
||||
super(context, DB_NAME, null, DB_VER);
|
||||
}
|
||||
|
||||
public List<Order> getCarts() {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||
|
||||
String[] sqlSelect = {"ProductName", "ProductId", "Quantity", "Price", "Discount"};
|
||||
String sqlTable="OrderDetail";
|
||||
|
||||
qb.setTables(sqlTable);
|
||||
Cursor c = qb.query(db, sqlSelect, null, null, null, null, null);
|
||||
|
||||
final List<Order> result = new ArrayList<>();
|
||||
if(c.moveToFirst()) {
|
||||
do {
|
||||
result.add(new Order(c.getString(c.getColumnIndexOrThrow("ProductId")),
|
||||
c.getString(c.getColumnIndexOrThrow("ProductName")),
|
||||
c.getString(c.getColumnIndexOrThrow("Quantity")),
|
||||
c.getString(c.getColumnIndexOrThrow("Price")),
|
||||
c.getString(c.getColumnIndexOrThrow("Discount"))
|
||||
));
|
||||
} while(c.moveToNext());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addToCart(Order order) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
String query = String.format("INSERT INTO OrderDetail(ProductId, ProductName, Quantity, Price,Discount) VALUES ('%s', '%s','%s','%s','%s');",
|
||||
order.getProductId(),
|
||||
order.getProductName(),
|
||||
order.getQuantity(),
|
||||
order.getPrice(),
|
||||
order.getDiscount());
|
||||
db.execSQL(query);
|
||||
}
|
||||
|
||||
public void cleanCart() {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
String query = String.format("DELETE FROM OrderDetail");
|
||||
db.execSQL(query);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.waterbase.foodify.Database.Database;
|
||||
import com.waterbase.foodify.Model.Food;
|
||||
import com.waterbase.foodify.Model.Order;
|
||||
|
||||
public class FoodDetail extends AppCompatActivity {
|
||||
|
||||
|
||||
TextView food_name, food_price, food_description;
|
||||
ImageView food_image;
|
||||
CollapsingToolbarLayout collapsingToolbarLayout;
|
||||
FloatingActionButton btnCart;
|
||||
ElegantNumberButton numberButton;
|
||||
|
||||
String foodId = "";
|
||||
|
||||
FirebaseDatabase database;
|
||||
DatabaseReference foods;
|
||||
|
||||
Food currentFood;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_food_detail);
|
||||
|
||||
//Firebase
|
||||
database = FirebaseDatabase.getInstance();
|
||||
foods = database.getReference("Foods");
|
||||
|
||||
//Init view
|
||||
numberButton = (ElegantNumberButton) findViewById(R.id.number_button);
|
||||
btnCart = (FloatingActionButton) findViewById(R.id.btnCart);
|
||||
|
||||
btnCart.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Database(getBaseContext()).addToCart(new Order(
|
||||
foodId,
|
||||
currentFood.getName(),
|
||||
numberButton.getNumber(),
|
||||
currentFood.getPrice(),
|
||||
currentFood.getDiscount()
|
||||
));
|
||||
|
||||
Toast.makeText(FoodDetail.this, "Added to Cart", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
food_description = (TextView) findViewById(R.id.food_description);
|
||||
food_name = (TextView) findViewById(R.id.food_name);
|
||||
food_price = (TextView) findViewById(R.id.food_price);
|
||||
food_image = (ImageView) findViewById(R.id.img_food);
|
||||
|
||||
collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing);
|
||||
collapsingToolbarLayout.setExpandedTitleTextAppearance(R.style.ExpandedAppbar);
|
||||
collapsingToolbarLayout.setCollapsedTitleTextAppearance(R.style.CollapsedAppbar);
|
||||
|
||||
//Get Food Id from Intent
|
||||
if(getIntent() != null)
|
||||
foodId = getIntent().getStringExtra("FoodId");
|
||||
if(!foodId.isEmpty()) {
|
||||
getDetailFood(foodId);
|
||||
}
|
||||
|
||||
setTitle("Chi tiết");
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
private void getDetailFood(String foodId) {
|
||||
foods.child(foodId).addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
currentFood = dataSnapshot.getValue(Food.class);
|
||||
|
||||
//Set Image
|
||||
Picasso.with(getBaseContext()).load(currentFood.getImage()).into(food_image);
|
||||
|
||||
collapsingToolbarLayout.setTitle(currentFood.getName());
|
||||
|
||||
food_price.setText(currentFood.getPrice());
|
||||
|
||||
food_name.setText(currentFood.getName());
|
||||
|
||||
food_description.setText(currentFood.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.firebase.ui.database.FirebaseRecyclerAdapter;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.mancj.materialsearchbar.MaterialSearchBar;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.Model.Food;
|
||||
import com.waterbase.foodify.ViewHolder.FoodViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FoodList extends AppCompatActivity {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
RecyclerView.LayoutManager layoutManager;
|
||||
|
||||
FirebaseDatabase database;
|
||||
DatabaseReference foodList;
|
||||
|
||||
String categoryId = "", categoryName = "";
|
||||
|
||||
FirebaseRecyclerAdapter<Food, FoodViewHolder> adapter;
|
||||
|
||||
//Search functionality
|
||||
FirebaseRecyclerAdapter<Food, FoodViewHolder> searchAdapter;
|
||||
List<String> suggestList = new ArrayList<>();
|
||||
MaterialSearchBar materialSearchBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_food_list);
|
||||
|
||||
//Firebase
|
||||
database = FirebaseDatabase.getInstance();
|
||||
foodList = database.getReference("Foods");
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyler_food);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
//Get Intent here
|
||||
if(getIntent() != null)
|
||||
categoryId = getIntent().getStringExtra("CategoryId");
|
||||
categoryName = getIntent().getStringExtra("CategoryName");
|
||||
if(!categoryId.isEmpty() && categoryId != null) {
|
||||
loadListFood(categoryId);
|
||||
}
|
||||
|
||||
//Search
|
||||
materialSearchBar = (MaterialSearchBar) findViewById(R.id.searchBar);
|
||||
materialSearchBar.setHint("Enter your food");
|
||||
loadSuggest();
|
||||
materialSearchBar.setLastSuggestions(suggestList);
|
||||
materialSearchBar.setCardViewElevation(10);
|
||||
materialSearchBar.addTextChangeListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
//When user type their text, we will change suggest list
|
||||
|
||||
List<String> suggest = new ArrayList<String>();
|
||||
for(String search:suggestList) {
|
||||
if(search.toLowerCase().contains(materialSearchBar.getText().toLowerCase()))
|
||||
suggest.add(search);
|
||||
}
|
||||
materialSearchBar.setLastSuggestions(suggest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
materialSearchBar.setOnSearchActionListener(new MaterialSearchBar.OnSearchActionListener() {
|
||||
@Override
|
||||
public void onSearchStateChanged(boolean enabled) {
|
||||
//When search bar is close
|
||||
//Restore original adapter
|
||||
if(!enabled)
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchConfirmed(CharSequence text) {
|
||||
//When search finish
|
||||
//Show result of search adapter
|
||||
startSearch(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onButtonClicked(int buttonCode) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setTitle(categoryName);
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void startSearch(CharSequence text) {
|
||||
searchAdapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(
|
||||
Food.class,
|
||||
R.layout.food_item,
|
||||
FoodViewHolder.class,
|
||||
foodList.orderByChild("Name").equalTo(text.toString())
|
||||
) {
|
||||
@Override
|
||||
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int i) {
|
||||
viewHolder.food_name.setText(model.getName());
|
||||
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
|
||||
|
||||
viewHolder.setItemClickListener(new ItemClickListener() {
|
||||
@Override
|
||||
public void onClick(View view, int position, boolean isLongClick) {
|
||||
//Start Activity
|
||||
Intent foodDetail = new Intent(FoodList.this, FoodDetail.class);
|
||||
foodDetail.putExtra("FoodId", searchAdapter.getRef(position).getKey()); // Send Food Id to new activity
|
||||
startActivity(foodDetail);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
recyclerView.setAdapter(searchAdapter); //Set adapter for Recycler View is Search result
|
||||
}
|
||||
|
||||
private void loadSuggest() {
|
||||
foodList.orderByChild("MenuId").equalTo(categoryId)
|
||||
.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
for(DataSnapshot postSnapshot: dataSnapshot.getChildren()){
|
||||
Food item = postSnapshot.getValue(Food.class);
|
||||
suggestList.add(item.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadListFood(String categoryId){
|
||||
adapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class, R.layout.food_item,
|
||||
FoodViewHolder.class, foodList.orderByChild("MenuId").equalTo(categoryId) // like: Select * from Foods where MenuId = 'categoryId'
|
||||
) {
|
||||
@Override
|
||||
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position) {
|
||||
viewHolder.food_name.setText(model.getName());
|
||||
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
|
||||
|
||||
final Food local = model;
|
||||
viewHolder.setItemClickListener(new ItemClickListener() {
|
||||
@Override
|
||||
public void onClick(View view, int position, boolean isLongClick) {
|
||||
//Start Activity
|
||||
Intent foodDetail = new Intent(FoodList.this, FoodDetail.class);
|
||||
foodDetail.putExtra("FoodId", adapter.getRef(position).getKey()); // Send Food Id to new activity
|
||||
startActivity(foodDetail);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//Set Adapter
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.firebase.ui.database.FirebaseRecyclerAdapter;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.waterbase.foodify.Common.Common;
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.Model.Category;
|
||||
import com.waterbase.foodify.ViewHolder.MenuViewHolder;
|
||||
|
||||
|
||||
public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
|
||||
|
||||
FirebaseDatabase database;
|
||||
DatabaseReference category;
|
||||
|
||||
RecyclerView recyler_menu;
|
||||
RecyclerView.LayoutManager layoutManager;
|
||||
FirebaseRecyclerAdapter<Category, MenuViewHolder> adapter;
|
||||
|
||||
private AppBarConfiguration mAppBarConfiguration;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_home);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle("Menu");
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.app_name, R.string.app_name);
|
||||
drawer.setDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
|
||||
//Init database
|
||||
database = FirebaseDatabase.getInstance();
|
||||
category = database.getReference("Category");
|
||||
|
||||
//Load menu
|
||||
recyler_menu = (RecyclerView) findViewById(R.id.recyler_menu);
|
||||
recyler_menu.setHasFixedSize(true);
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recyler_menu.setLayoutManager(layoutManager);
|
||||
|
||||
loadMenu();
|
||||
|
||||
//Set name for user
|
||||
View headerView = navigationView.getHeaderView(0);
|
||||
TextView navUserName = (TextView) headerView.findViewById(R.id.txtFullName);
|
||||
navUserName.setText(Common.currentUser.getName());
|
||||
}
|
||||
|
||||
private void loadMenu() {
|
||||
adapter = new FirebaseRecyclerAdapter<Category, MenuViewHolder>(Category.class, R.layout.menu_item, MenuViewHolder.class, category) {
|
||||
@Override
|
||||
protected void populateViewHolder(MenuViewHolder viewHolder, Category model, int position) {
|
||||
viewHolder.txtMenuName.setText(model.getName());
|
||||
Picasso.with(getBaseContext()).load(model.getImage())
|
||||
.into(viewHolder.imageView);
|
||||
viewHolder.setItemClickListener(new ItemClickListener() {
|
||||
@Override
|
||||
public void onClick(View view, int position, boolean isLongClick) {
|
||||
//Get Category Id and send to new Activity
|
||||
Intent foodList = new Intent(getBaseContext(), FoodList.class);
|
||||
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
|
||||
foodList.putExtra("CategoryName", model.getName());
|
||||
startActivity(foodList);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
recyler_menu.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.home, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if(id == R.id.nav_cart) {
|
||||
Intent cartIntent = new Intent(Home.this, Cart.class);
|
||||
startActivity(cartIntent);
|
||||
} else if (id == R.id.nav_order) {
|
||||
Intent orderIntent = new Intent(Home.this, OrderStatus.class);
|
||||
startActivity(orderIntent);
|
||||
} else if (id == R.id.nav_log_out) {
|
||||
Intent signIn = new Intent(Home.this, SignIn.class);
|
||||
signIn.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(signIn);
|
||||
finish();
|
||||
}
|
||||
|
||||
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawerLayout.closeDrawer(GravityCompat.START);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.waterbase.foodify.Interface;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onClick(View view, int position, boolean isLongClick);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
public class Category {
|
||||
private String Name;
|
||||
private String Image;
|
||||
|
||||
public Category() {
|
||||
}
|
||||
|
||||
public Category(String name, String image) {
|
||||
Name = name;
|
||||
Image = image;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return Image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
Image = image;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
public class Food {
|
||||
private String Name, Image, Description, Price, Discount, MenuId;
|
||||
|
||||
public Food() {}
|
||||
|
||||
public Food(String name, String image, String description, String price, String discount, String menuId) {
|
||||
Name = name;
|
||||
Image = image;
|
||||
Description = description;
|
||||
Price = price;
|
||||
Discount = discount;
|
||||
MenuId = menuId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return Image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
Image = image;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return Description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return Price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
Price = price;
|
||||
}
|
||||
|
||||
public String getDiscount() {
|
||||
return Discount;
|
||||
}
|
||||
|
||||
public void setDiscount(String discount) {
|
||||
Discount = discount;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return MenuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
MenuId = menuId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
public class Order {
|
||||
|
||||
private String ProductId;
|
||||
private String ProductName;
|
||||
private String Quantity;
|
||||
private String Price;
|
||||
private String Discount;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public Order(String productId, String productName, String quantity, String price, String discount) {
|
||||
ProductId = productId;
|
||||
ProductName = productName;
|
||||
Quantity = quantity;
|
||||
Price = price;
|
||||
Discount = discount;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return ProductId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
ProductId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return ProductName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
ProductName = productName;
|
||||
}
|
||||
|
||||
public String getQuantity() {
|
||||
return Quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(String quantity) {
|
||||
Quantity = quantity;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return Price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
Price = price;
|
||||
}
|
||||
|
||||
public String getDiscount() {
|
||||
return Discount;
|
||||
}
|
||||
|
||||
public void setDiscount(String discount) {
|
||||
Discount = discount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Request {
|
||||
private String phone;
|
||||
private String name;
|
||||
private String address;
|
||||
private String total;
|
||||
private String status;
|
||||
private List<Order> foods; // list of food order
|
||||
|
||||
public Request() {
|
||||
}
|
||||
|
||||
public Request(String phone, String name, String address, String total, List<Order> foods) {
|
||||
this.phone = phone;
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.total = total;
|
||||
this.foods = foods;
|
||||
this.status = "0"; // Default is 0, 0: Placed, 1: Shipping, 2: Shipped
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(String total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<Order> getFoods() {
|
||||
return foods;
|
||||
}
|
||||
|
||||
public void setFoods(List<Order> foods) {
|
||||
this.foods = foods;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
public class User {
|
||||
|
||||
private String Name;
|
||||
private String Password;
|
||||
private String Phone;
|
||||
private String IsStaff;
|
||||
|
||||
public User(){}
|
||||
|
||||
public User(String name, String password){
|
||||
Name = name;
|
||||
Password = password;
|
||||
IsStaff = "false";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public String getIsStaff() {
|
||||
return IsStaff;
|
||||
}
|
||||
|
||||
public void setIsStaff(String isStaff) {
|
||||
IsStaff = isStaff;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return Password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
Password = password;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return Phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
Phone = phone;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.firebase.ui.database.FirebaseRecyclerAdapter;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.waterbase.foodify.Common.Common;
|
||||
import com.waterbase.foodify.Model.Request;
|
||||
import com.waterbase.foodify.ViewHolder.OrderViewHolder;
|
||||
|
||||
public class OrderStatus extends AppCompatActivity {
|
||||
|
||||
public RecyclerView recyclerView;
|
||||
public RecyclerView.LayoutManager layoutManager;
|
||||
|
||||
FirebaseRecyclerAdapter<Request, OrderViewHolder> adapter;
|
||||
|
||||
FirebaseDatabase database;
|
||||
DatabaseReference requests;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_order_status);
|
||||
|
||||
//Firebase
|
||||
database = FirebaseDatabase.getInstance();
|
||||
requests = database.getReference("Requests");
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.listOrders);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
loadOrders(Common.currentUser.getPhone());
|
||||
|
||||
setTitle("Tình trạng đơn hàng");
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void loadOrders(String phone) {
|
||||
adapter = new FirebaseRecyclerAdapter<Request, OrderViewHolder>(
|
||||
Request.class,
|
||||
R.layout.order_layout,
|
||||
OrderViewHolder.class,
|
||||
requests.orderByChild("phone")
|
||||
.equalTo(phone)
|
||||
) {
|
||||
@Override
|
||||
protected void populateViewHolder(OrderViewHolder orderViewHolder, Request model, int i) {
|
||||
orderViewHolder.txtOrderId.setText(adapter.getRef(i).getKey());
|
||||
orderViewHolder.txtOrderStatus.setText(converCodeToStatus(model.getStatus()));
|
||||
orderViewHolder.txtOrderAddress.setText(model.getAddress());
|
||||
orderViewHolder.txtOrderPhone.setText(model.getPhone());
|
||||
}
|
||||
};
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private String converCodeToStatus(String status) {
|
||||
if(status.equals("0"))
|
||||
return "Placed";
|
||||
else if(status.equals("1"))
|
||||
return "On my way";
|
||||
else
|
||||
return "Shipped";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.waterbase.foodify.Common.Common;
|
||||
import com.waterbase.foodify.Model.User;
|
||||
|
||||
public class SignIn extends AppCompatActivity {
|
||||
|
||||
EditText edtPhone, edtPassword;
|
||||
Button btnSignIn;
|
||||
TextView txtAppName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign_in);
|
||||
|
||||
edtPassword = (EditText) findViewById(R.id.edtPassword);
|
||||
edtPhone = (EditText) findViewById(R.id.edtPhone);
|
||||
btnSignIn = (Button) findViewById(R.id.btnSignIn);
|
||||
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
//Init Firebase
|
||||
FirebaseDatabase database = FirebaseDatabase.getInstance();
|
||||
final DatabaseReference table_user = database.getReference("User");
|
||||
|
||||
btnSignIn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final ProgressDialog mDialog = new ProgressDialog(SignIn.this);
|
||||
mDialog.setMessage("Please waiting...");
|
||||
mDialog.show();
|
||||
|
||||
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
//Check phone and password is null or not
|
||||
if(!edtPhone.getText().toString().isEmpty() && !edtPassword.getText().toString().isEmpty()){
|
||||
//Check if user not in database
|
||||
if(dataSnapshot.child(edtPhone.getText().toString()).exists()){
|
||||
//Get User information
|
||||
mDialog.dismiss();
|
||||
User user = dataSnapshot.child(edtPhone.getText().toString()).getValue(User.class);
|
||||
user.setPhone(edtPhone.getText().toString());
|
||||
if(user.getPassword().equals(edtPassword.getText().toString())){
|
||||
Intent homeIntent = new Intent(SignIn.this, Home.class);
|
||||
Common.currentUser = user;
|
||||
startActivity(homeIntent);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(SignIn.this, "Số điện thoại hoặc mật khẩu không đúng. Xin vui lòng thử lại!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
mDialog.dismiss();
|
||||
Toast.makeText(SignIn.this, "Số điện thoại chưa được đăng ký. Vui lòng đăng ký để sử dụng!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else{
|
||||
mDialog.dismiss();
|
||||
Toast.makeText(SignIn.this, "Số điện thoại và mật khẩu không được để trống. Vui lòng thử lại!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void register(View view) {
|
||||
startActivity(new Intent(SignIn.this, com.waterbase.foodify.SignUp.class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.waterbase.foodify.Model.User;
|
||||
|
||||
public class SignUp extends AppCompatActivity {
|
||||
|
||||
EditText edtPhone, edtName, edtPassword;
|
||||
Button btnSignUp;
|
||||
TextView txtAppName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign_up);
|
||||
|
||||
edtName = (EditText) findViewById(R.id.txtFullName);
|
||||
edtPassword = (EditText) findViewById(R.id.edtPassword);
|
||||
edtPhone = (EditText) findViewById(R.id.edtPhone);
|
||||
|
||||
btnSignUp = (Button) findViewById(R.id.btnSignUp);
|
||||
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
//Init Firebase
|
||||
FirebaseDatabase database = FirebaseDatabase.getInstance();
|
||||
final DatabaseReference table_user = database.getReference("User");
|
||||
|
||||
btnSignUp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ProgressDialog mDialog = new ProgressDialog(SignUp.this);
|
||||
mDialog.setMessage("Please waiting...");
|
||||
mDialog.show();
|
||||
|
||||
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
//Check if already user phone
|
||||
if(dataSnapshot.child(edtPhone.getText().toString()).exists()) {
|
||||
mDialog.dismiss();
|
||||
Toast.makeText(SignUp.this, "Phone Number is already register!", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
mDialog.dismiss();
|
||||
User user = new User(edtName.getText().toString(), edtPassword.getText().toString());
|
||||
table_user.child(edtPhone.getText().toString()).setValue(user);
|
||||
Toast.makeText(SignUp.this, "Sign up successfully!", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void login(View view) {
|
||||
startActivity(new Intent(SignUp.this, SignIn.class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.waterbase.foodify.ViewHolder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.Model.Order;
|
||||
import com.waterbase.foodify.R;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
class CartViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
public TextView txt_card_item, txt_price;
|
||||
public ImageView img_cart_count;
|
||||
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public void setTxt_card_item(TextView txt_card_item) {
|
||||
this.txt_card_item = txt_card_item;
|
||||
}
|
||||
|
||||
public CartViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
txt_card_item = (TextView) itemView.findViewById(R.id.cart_item_name);
|
||||
txt_price = (TextView) itemView.findViewById(R.id.cart_item_Price);
|
||||
img_cart_count = (ImageView) itemView.findViewById(R.id.cart_item_count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class CartAdapter extends RecyclerView.Adapter<CartViewHolder>{
|
||||
|
||||
private List<Order> listData = new ArrayList<>();
|
||||
private Context context;
|
||||
|
||||
public CartAdapter(List<Order> listData, Context context) {
|
||||
this.listData = listData;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CartViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View itemView = inflater.inflate(R.layout.cart_layout, parent, false);
|
||||
return new CartViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CartViewHolder holder, int position) {
|
||||
TextDrawable drawable = TextDrawable.builder().buildRound("" + listData.get(position).getQuantity(), Color.RED);
|
||||
holder.img_cart_count.setImageDrawable(drawable);
|
||||
|
||||
Locale locale = new Locale("vi", "VN");
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
float price = (Float.parseFloat(listData.get(position).getPrice()))*(Float.parseFloat(listData.get(position).getQuantity()));
|
||||
holder.txt_price.setText(fmt.format(price));
|
||||
|
||||
holder.txt_card_item.setText(listData.get(position).getProductName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listData.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.waterbase.foodify.ViewHolder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.R;
|
||||
|
||||
public class FoodViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
public TextView food_name;
|
||||
public ImageView food_image;
|
||||
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public void setItemClickListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
public FoodViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
food_name = (TextView) itemView.findViewById(R.id.food_name);
|
||||
food_image = (ImageView) itemView.findViewById(R.id.food_image);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
itemClickListener.onClick(v, getAdapterPosition(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.waterbase.foodify.ViewHolder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.R;
|
||||
|
||||
public class MenuViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
public TextView txtMenuName;
|
||||
public ImageView imageView;
|
||||
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public MenuViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
txtMenuName = (TextView) itemView.findViewById(R.id.menu_name);
|
||||
imageView = (ImageView) itemView.findViewById(R.id.menu_image);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void setItemClickListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
itemClickListener.onClick(v, getAdapterPosition(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.waterbase.foodify.ViewHolder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.waterbase.foodify.Interface.ItemClickListener;
|
||||
import com.waterbase.foodify.R;
|
||||
|
||||
public class OrderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
public TextView txtOrderId, txtOrderStatus, txtOrderPhone, txtOrderAddress;
|
||||
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public OrderViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
txtOrderAddress = (TextView) itemView.findViewById(R.id.order_address);
|
||||
txtOrderId = (TextView) itemView.findViewById(R.id.order_id);
|
||||
txtOrderStatus = (TextView) itemView.findViewById(R.id.order_status);
|
||||
txtOrderPhone = (TextView) itemView.findViewById(R.id.order_phone);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void setItemClickListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
itemClickListener.onClick(v, getAdapterPosition(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class Welcome extends AppCompatActivity {
|
||||
|
||||
Button btnSignIn, btnSignUp;
|
||||
TextView txtSlogan, txtAppName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_welcome);
|
||||
|
||||
btnSignIn = (Button) findViewById(R.id.btnSignIn);
|
||||
btnSignUp = (Button) findViewById(R.id.btnSignUp);
|
||||
|
||||
txtSlogan = (TextView) findViewById(R.id.txtSlogan);
|
||||
txtAppName = (TextView)findViewById(R.id.txtAppName);
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
txtSlogan.setTypeface(face);
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
|
||||
btnSignIn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent signIn = new Intent(Welcome.this, SignIn.class);
|
||||
startActivity(signIn);
|
||||
}
|
||||
});
|
||||
|
||||
btnSignUp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent signUp = new Intent(Welcome.this, SignUp.class);
|
||||
startActivity(signUp);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 15 MiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<corners android:radius="50dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:startColor="#aa000000"
|
||||
android:endColor="#aa000000"/>
|
||||
<corners android:radius="0dp"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12.65,10C11.83,7.67 9.61,6 7,6c-3.31,0 -6,2.69 -6,6s2.69,6 6,6c2.61,0 4.83,-1.67 5.65,-4H17v4h4v-4h2v-4H12.65zM7,14c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<solid
|
||||
android:color="#858483"/>
|
||||
<corners android:radius="50dp" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 1.3 MiB |
@@ -0,0 +1,6 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M7,18c-1.1,0 -1.99,0.9 -1.99,2S5.9,22 7,22s2,-0.9 2,-2 -0.9,-2 -2,-2zM1,2v2h2l3.6,7.59 -1.35,2.45c-0.16,0.28 -0.25,0.61 -0.25,0.96 0,1.1 0.9,2 2,2h12v-2L7.42,15c-0.14,0 -0.25,-0.11 -0.25,-0.25l0.03,-0.12 0.9,-1.63h7.45c0.75,0 1.41,-0.41 1.75,-1.03l3.58,-6.49c0.08,-0.14 0.12,-0.31 0.12,-0.48 0,-0.55 -0.45,-1 -1,-1L5.21,4l-0.94,-2L1,2zM17,18c-1.1,0 -1.99,0.9 -1.99,2s0.89,2 1.99,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="#009688"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="#4DB6AC"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg4"
|
||||
android:padding="16dp"
|
||||
tools:context=".Cart">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/listCart"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_alignParentBottom="true"
|
||||
app:cardBackgroundColor="@color/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_margin="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:text="Total: "
|
||||
android:textSize="20sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total"
|
||||
android:text="$10,000"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<info.hoang8f.widget.FButton
|
||||
android:id="@+id/btnPlaceOrder"
|
||||
android:text="Place Order"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:fButtonColor="@color/btnSignActive"
|
||||
app:shadowColor="@android:color/black"
|
||||
app:shadowEnabled="true"
|
||||
app:shadowHeight="5dp"
|
||||
app:cornerRadius="4dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".FoodDetail">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="#0e0d0e"
|
||||
app:expandedTitleTextAppearance="@android:color/black"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_food"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_collapseMode="parallax"
|
||||
|
||||
/>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/btnCart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/white"
|
||||
android:elevation="6dp"
|
||||
android:src="@drawable/ic_baseline_shopping_cart_24"
|
||||
app:layout_anchor="@id/app_bar_layout"
|
||||
app:layout_anchorGravity="bottom|right|end"
|
||||
app:pressedTranslationZ="12dp"
|
||||
app:useCompatPadding="true"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="5dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:padding="12dp"
|
||||
android:text="Food Name"
|
||||
android:textColor="@color/purple_500"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_baseline_attach_money_24"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_price"
|
||||
android:text="1,000"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/number_button"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
app:textSize="8sp"
|
||||
app:backGroundColor="@color/colorPrimary"
|
||||
app:initialNumber="1"
|
||||
app:finalNumber="20"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
app:cardElevation="5dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:lineSpacingMultiplier="1.5"
|
||||
android:padding="12dp"
|
||||
android:text="Description"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".FoodList">
|
||||
|
||||
<com.mancj.materialsearchbar.MaterialSearchBar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:id="@+id/searchBar"
|
||||
app:mt_speechMode="false"
|
||||
app:mt_hint="Enter your food"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_below="@+id/searchBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/recyler_food"
|
||||
android:scrollbars="vertical"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include
|
||||
android:id="@+id/app_bar_home"
|
||||
layout="@layout/app_bar_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@color/overlayBackground"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_home"
|
||||
|
||||
app:itemIconTint="@color/white"
|
||||
app:itemTextColor="@color/white"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".OrderStatus">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/listOrders"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"></androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.waterbase.foodify.SignIn">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/foreground_design"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/bg4"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="-32dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAppName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="33sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias=".2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtSignUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="Đăng nhập"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtPhone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_local_phone_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:hint="Số điện thoại"
|
||||
android:inputType="phone"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtSignUp"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtPassword"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:hint="Mật khẩu"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edtPhone"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSignIn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_bg_design"
|
||||
android:padding="10dp"
|
||||
android:text="Đăng nhập"
|
||||
android:textAllCaps="false"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edtPassword"
|
||||
app:layout_constraintVertical_bias="0.7"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Chưa có tài khoản Foodify?"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias=".3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnSignIn" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="Đăng ký tại đây!"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/purple_500"
|
||||
android:textStyle="bold"
|
||||
android:onClick="register"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnSignIn" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.waterbase.foodify.SignUp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/foreground_design"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/bg4"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="-32dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAppName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="33sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias=".2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtSignUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="Đăng ký"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtFullName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_account_circle_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:hint="Họ và tên"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtSignUp"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtPhone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_local_phone_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:layout_margin="10dp"
|
||||
android:hint="Số điện thoại"
|
||||
android:inputType="phone"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtFullName"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtPassword"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:hint="Mật khẩu"
|
||||
android:layout_margin="10dp"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edtPhone"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSignUp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_bg_design"
|
||||
android:padding="10dp"
|
||||
android:text="Đăng ký"
|
||||
android:textAllCaps="false"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edtPassword"
|
||||
app:layout_constraintVertical_bias="0.7"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Đã tạo tài khoản?"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias=".3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnSignUp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="Đăng nhập tại đây!"
|
||||
android:onClick="login"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/purple_500"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnSignUp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Welcome">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/foreground_design"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/bg2"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAppName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="33sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtSlogan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="2dp"
|
||||
android:text="@string/slogan"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSignUp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="Đăng ký"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtSlogan"
|
||||
app:layout_constraintVertical_bias="0.7"
|
||||
app:layout_constraintWidth_percent=".8"
|
||||
android:background="@drawable/btn_bg_design"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btnSignIn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="Đăng nhập"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnSignUp"
|
||||
app:layout_constraintVertical_bias="0.2"
|
||||
app:layout_constraintWidth_percent=".8"
|
||||
android:background="@drawable/sign_in_button"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Home">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/Theme.Foodify.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/Theme.Foodify.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_home" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:cardElevation="4dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cart_item_name"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold"
|
||||
android:text="Food 01"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cart_item_Price"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="italic"
|
||||
android:text="100,000"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginRight="16dp"
|
||||
android:id="@+id/cart_item_count"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:showIn="@layout/app_bar_home">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyler_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
app:cardElevation="4dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/food_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#4f0e0d0e"
|
||||
android:gravity="center"
|
||||
android:text="Name of Food"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
app:cardElevation="4dp"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_image"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/menu_name"
|
||||
android:text="Name of Menu"
|
||||
android:textColor="@color/white"
|
||||
android:background="#4f0e0d0e"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
app:srcCompat="@mipmap/ic_launcher_round" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtFullName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
android:text="@string/nav_header_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_header_subtitle" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:cardElevation="4dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_id"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold"
|
||||
android:text="#11111"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_status"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="italic"
|
||||
android:text="Status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_phone"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="italic"
|
||||
android:text="Phone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_address"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="italic"
|
||||
android:text="Address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="navigation_view">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/nav_cart"
|
||||
android:icon="@drawable/ic_baseline_shopping_cart_24"
|
||||
android:title="Giỏ hàng" />
|
||||
<item
|
||||
android:id="@+id/nav_order"
|
||||
android:icon="@drawable/ic_baseline_access_time_24"
|
||||
android:title="Tình trạng đơn hàng" />
|
||||
<item
|
||||
android:id="@+id/nav_log_out"
|
||||
android:icon="@drawable/ic_baseline_exit_to_app_24"
|
||||
android:iconTint="@color/white"
|
||||
android:title="Đăng xuất"
|
||||
/>
|
||||
</group>
|
||||
</menu>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
</menu>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Foodify" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">200dp</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF5353</color>
|
||||
<color name="purple_700">#FF5353</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="colorPrimary">#004d40</color>
|
||||
<color name="colorPrimaryDark">#00251a</color>
|
||||
<color name="colorAccent">#39796b</color>
|
||||
|
||||
<color name="btnSignUp">#39796b</color>
|
||||
<color name="btnSignActive">#A9d440</color>
|
||||
|
||||
<color name="overlayBackground">#7f333639</color>
|
||||
<color name="overlayActionBar">#0e0d0e</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
||||
<dimen name="nav_header_height">176dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
<string name="app_name">Foodify</string>
|
||||
<string name="slogan">No matter where you are whether you are at home, or in the office, or on the beach - we will find you and we will feed you.</string>
|
||||
<string name="title_activity_home">Home</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="nav_header_title">Android Studio</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,36 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Foodify" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Foodify.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Foodify.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="Theme.Foodify.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="CollapsedAppbar" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textSize">24sp</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<style name="ExpandedAppbar" parent="@android:style/TextAppearance.Material.Title">
|
||||
<item name="android:textColor">@color/purple_500</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.android.application' version '7.2.0' apply false
|
||||
id 'com.android.library' version '7.2.0' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.enableJetifier=true
|
||||
@@ -0,0 +1,6 @@
|
||||
#Wed May 25 07:51:51 ICT 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,10 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Foodify"
|
||||
include ':app'
|
||||