mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 20:00:50 +00:00
Add basket fragment
This commit is contained in:
+2
-1
@@ -56,7 +56,8 @@ dependencies {
|
|||||||
implementation 'com.github.smarteist:autoimageslider:1.4.0'
|
implementation 'com.github.smarteist:autoimageslider:1.4.0'
|
||||||
implementation 'com.github.bumptech.glide:glide:4.14.2'
|
implementation 'com.github.bumptech.glide:glide:4.14.2'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
|
||||||
implementation "com.github.kojofosu:Quantitizer:1.6.7"
|
implementation 'com.github.kojofosu:Quantitizer:1.6.7'
|
||||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||||
implementation 'com.github.ome450901:SimpleRatingBar:1.5.1'
|
implementation 'com.github.ome450901:SimpleRatingBar:1.5.1'
|
||||||
|
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Foodify"
|
android:theme="@style/Theme.Foodify"
|
||||||
|
tools:replace="android:theme"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activity.ChangePasswordActivity"
|
android:name=".Activity.ChangePasswordActivity"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.capstone.foodify.Activity;
|
package com.capstone.foodify.Activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -21,6 +23,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.capstone.foodify.API.FoodApi;
|
import com.capstone.foodify.API.FoodApi;
|
||||||
|
import com.capstone.foodify.Common;
|
||||||
|
import com.capstone.foodify.Model.Basket.Basket;
|
||||||
import com.capstone.foodify.Model.Food.Food;
|
import com.capstone.foodify.Model.Food.Food;
|
||||||
import com.capstone.foodify.Model.Food.ImageFood;
|
import com.capstone.foodify.Model.Food.ImageFood;
|
||||||
import com.capstone.foodify.Model.Review.Review;
|
import com.capstone.foodify.Model.Review.Review;
|
||||||
@@ -50,7 +54,7 @@ public class FoodDetailActivity extends AppCompatActivity {
|
|||||||
private ImageView back_image, favourite_icon;
|
private ImageView back_image, favourite_icon;
|
||||||
private String foodId = "";
|
private String foodId = "";
|
||||||
private Food food;
|
private Food food;
|
||||||
private static List<String> imageFood = new ArrayList<>();
|
private static final List<String> imageFood = new ArrayList<>();
|
||||||
private TextView foodName_txt, shopName_txt, discount_txt, description_txt, price_txt, total_txt, countRating_txt, description_content_txt;
|
private TextView foodName_txt, shopName_txt, discount_txt, description_txt, price_txt, total_txt, countRating_txt, description_content_txt;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private Button add_to_basket_button;
|
private Button add_to_basket_button;
|
||||||
@@ -114,6 +118,7 @@ public class FoodDetailActivity extends AppCompatActivity {
|
|||||||
public void onDecrease() {
|
public void onDecrease() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
public void onValueChanged(int i) {
|
public void onValueChanged(int i) {
|
||||||
Locale locale = new Locale("vi", "VN");
|
Locale locale = new Locale("vi", "VN");
|
||||||
@@ -131,6 +136,7 @@ public class FoodDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
getImageFoodById(foodId);
|
getImageFoodById(foodId);
|
||||||
|
|
||||||
|
//Turn previous action when click
|
||||||
back_image.setOnClickListener(new View.OnClickListener() {
|
back_image.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -138,12 +144,24 @@ public class FoodDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Open dialog review
|
||||||
rating_button.setOnClickListener(new View.OnClickListener() {
|
rating_button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
openReviewDialog(Gravity.CENTER);
|
openReviewDialog(Gravity.CENTER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Add food to basket
|
||||||
|
add_to_basket_button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Common.LIST_BASKET_FOOD.add(new Basket(food.getId(), imageFood.get(0), food.getName(), food.getPrice(), food.getShopName(),
|
||||||
|
String.valueOf(horizontalQuantitizer.getValue())));
|
||||||
|
Toast.makeText(FoodDetailActivity.this, "Thêm vào giỏ hàng thành công!", Toast.LENGTH_SHORT).show();
|
||||||
|
startActivity(new Intent(FoodDetailActivity.this, MainActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Review> getListReview(){
|
private List<Review> getListReview(){
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.capstone.foodify;
|
||||||
|
|
||||||
|
import com.capstone.foodify.Model.Basket.Basket;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Common {
|
||||||
|
public static List<Basket> LIST_BASKET_FOOD = new ArrayList<>();
|
||||||
|
}
|
||||||
@@ -1,20 +1,95 @@
|
|||||||
package com.capstone.foodify.Fragment;
|
package com.capstone.foodify.Fragment;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.capstone.foodify.Common;
|
||||||
|
import com.capstone.foodify.ItemTouchHelperListener;
|
||||||
|
import com.capstone.foodify.Model.Basket.Basket;
|
||||||
|
import com.capstone.foodify.Model.Basket.BasketAdapter;
|
||||||
|
import com.capstone.foodify.Model.Basket.RecyclerViewItemTouchHelperBasketFood;
|
||||||
import com.capstone.foodify.R;
|
import com.capstone.foodify.R;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BasketFragment extends Fragment implements ItemTouchHelperListener {
|
||||||
|
|
||||||
|
private RecyclerView recyclerView_basket_food;
|
||||||
|
private BasketAdapter adapter;
|
||||||
|
private List<Basket> listBasketFood = new ArrayList<>();
|
||||||
|
private RelativeLayout listBasketFoodView;
|
||||||
|
|
||||||
public class BasketFragment extends Fragment {
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_basket, container, false);
|
View view = inflater.inflate(R.layout.fragment_basket, container, false);
|
||||||
|
|
||||||
|
//Init Component
|
||||||
|
recyclerView_basket_food = view.findViewById(R.id.recycler_view_basket_food);
|
||||||
|
listBasketFoodView = view.findViewById(R.id.list_basket_food_view);
|
||||||
|
adapter = new BasketAdapter();
|
||||||
|
|
||||||
|
//Get list food in basket
|
||||||
|
getListBasketFood();
|
||||||
|
|
||||||
|
//Set layout recyclerview
|
||||||
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||||
|
recyclerView_basket_food.setLayoutManager(linearLayoutManager);
|
||||||
|
|
||||||
|
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
|
||||||
|
recyclerView_basket_food.addItemDecoration(itemDecoration);
|
||||||
|
|
||||||
|
ItemTouchHelper.SimpleCallback simpleCallback = new RecyclerViewItemTouchHelperBasketFood(0, ItemTouchHelper.LEFT, this);
|
||||||
|
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerView_basket_food);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getListBasketFood(){
|
||||||
|
listBasketFood = Common.LIST_BASKET_FOOD;
|
||||||
|
adapter.setData(listBasketFood);
|
||||||
|
recyclerView_basket_food.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
System.out.println("On Resume Fragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwiped(RecyclerView.ViewHolder viewHolder) {
|
||||||
|
if(viewHolder instanceof BasketAdapter.BasketViewHolder){
|
||||||
|
String foodNameDelete = listBasketFood.get(viewHolder.getAdapterPosition()).getName();
|
||||||
|
|
||||||
|
Basket foodDelete = listBasketFood.get(viewHolder.getAdapterPosition());
|
||||||
|
int indexDelete = viewHolder.getAdapterPosition();
|
||||||
|
|
||||||
|
//Remove Item
|
||||||
|
adapter.removeItem(indexDelete, getContext());
|
||||||
|
|
||||||
|
//Show notification food has been delete
|
||||||
|
Snackbar snackbar = Snackbar.make(listBasketFoodView, foodNameDelete + " remove!", Snackbar.LENGTH_LONG);
|
||||||
|
snackbar.setAction("Undo", new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
adapter.undoItem(foodDelete, indexDelete, getContext());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
snackbar.setActionTextColor(Color.YELLOW);
|
||||||
|
snackbar.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-7
@@ -21,21 +21,18 @@ import com.capstone.foodify.ItemTouchHelperListener;
|
|||||||
import com.capstone.foodify.Model.Food.Food;
|
import com.capstone.foodify.Model.Food.Food;
|
||||||
import com.capstone.foodify.Model.Food.FoodFavoriteAdapter;
|
import com.capstone.foodify.Model.Food.FoodFavoriteAdapter;
|
||||||
import com.capstone.foodify.R;
|
import com.capstone.foodify.R;
|
||||||
import com.capstone.foodify.RecyclerViewItemTouchHelper;
|
import com.capstone.foodify.Model.Food.RecyclerViewItemTouchHelperFavoriteFood;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class FavouriteFragment extends Fragment implements ItemTouchHelperListener {
|
public class FavoriteFragment extends Fragment implements ItemTouchHelperListener {
|
||||||
|
|
||||||
private RecyclerView recyclerView_favorite_food;
|
private RecyclerView recyclerView_favorite_food;
|
||||||
private FoodFavoriteAdapter adapter;
|
private FoodFavoriteAdapter adapter;
|
||||||
@@ -59,11 +56,10 @@ public class FavouriteFragment extends Fragment implements ItemTouchHelperListen
|
|||||||
recyclerView_favorite_food.setLayoutManager(linearLayoutManager);
|
recyclerView_favorite_food.setLayoutManager(linearLayoutManager);
|
||||||
adapter = new FoodFavoriteAdapter();
|
adapter = new FoodFavoriteAdapter();
|
||||||
|
|
||||||
|
|
||||||
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
|
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
|
||||||
recyclerView_favorite_food.addItemDecoration(itemDecoration);
|
recyclerView_favorite_food.addItemDecoration(itemDecoration);
|
||||||
|
|
||||||
ItemTouchHelper.SimpleCallback simpleCallback = new RecyclerViewItemTouchHelper(0, ItemTouchHelper.LEFT, this);
|
ItemTouchHelper.SimpleCallback simpleCallback = new RecyclerViewItemTouchHelperFavoriteFood(0, ItemTouchHelper.LEFT, this);
|
||||||
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerView_favorite_food);
|
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerView_favorite_food);
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.capstone.foodify.Model.Basket;
|
||||||
|
|
||||||
|
public class Basket {
|
||||||
|
private String id;
|
||||||
|
private String img;
|
||||||
|
private String name;
|
||||||
|
private String price;
|
||||||
|
private String shopName;
|
||||||
|
private String quantity;
|
||||||
|
|
||||||
|
public Basket(String id, String img, String name, String price, String shopName, String quantity) {
|
||||||
|
this.id = id;
|
||||||
|
this.img = img;
|
||||||
|
this.name = name;
|
||||||
|
this.price = price;
|
||||||
|
this.shopName = shopName;
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(String price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShopName() {
|
||||||
|
return shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopName(String shopName) {
|
||||||
|
this.shopName = shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(String quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.capstone.foodify.Model.Basket;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.capstone.foodify.API.FoodApi;
|
||||||
|
import com.capstone.foodify.Model.Food.Food;
|
||||||
|
import com.capstone.foodify.R;
|
||||||
|
import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BasketAdapter extends RecyclerView.Adapter<BasketAdapter.BasketViewHolder> {
|
||||||
|
|
||||||
|
public List<Basket> listBasketFood;
|
||||||
|
|
||||||
|
public BasketAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public void setData(List<Basket> listBasketFood){
|
||||||
|
this.listBasketFood = listBasketFood;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public BasketViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_food_basket, parent, false);
|
||||||
|
return new BasketViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull BasketViewHolder holder, int position) {
|
||||||
|
Basket foodBasket = listBasketFood.get(position);
|
||||||
|
|
||||||
|
if(foodBasket == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Init data
|
||||||
|
holder.foodName.setText(foodBasket.getName());
|
||||||
|
holder.shopName.setText(foodBasket.getShopName());
|
||||||
|
holder.price.setText(foodBasket.getPrice());
|
||||||
|
Picasso.get().load(foodBasket.getImg()).into(holder.imageView);
|
||||||
|
holder.quantity.setNumber(foodBasket.getQuantity());
|
||||||
|
|
||||||
|
//Update quantity food when change quantity number
|
||||||
|
holder.quantity.setOnValueChangeListener(new ElegantNumberButton.OnValueChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ElegantNumberButton view, int oldValue, int newValue) {
|
||||||
|
foodBasket.setQuantity(String.valueOf(newValue));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
if(listBasketFood != null)
|
||||||
|
return listBasketFood.size();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BasketViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
|
||||||
|
TextView foodName, shopName, price;
|
||||||
|
public LinearLayout layoutForeGround;
|
||||||
|
ImageView imageView;
|
||||||
|
ElegantNumberButton quantity;
|
||||||
|
|
||||||
|
public BasketViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
//Init Component
|
||||||
|
foodName = itemView.findViewById(R.id.food_name_text_view);
|
||||||
|
shopName = itemView.findViewById(R.id.shop_name_text_view);
|
||||||
|
price = itemView.findViewById(R.id.price_text_view);
|
||||||
|
imageView = itemView.findViewById(R.id.image_view);
|
||||||
|
quantity = itemView.findViewById(R.id.quantity);
|
||||||
|
|
||||||
|
layoutForeGround = itemView.findViewById(R.id.layout_foreground);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeItem(int index, Context context){
|
||||||
|
listBasketFood.remove(index);
|
||||||
|
notifyItemRemoved(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void undoItem(Basket food, int index, Context context){
|
||||||
|
listBasketFood.add(index, food);
|
||||||
|
notifyItemInserted(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
package com.capstone.foodify.Model.Basket;
|
||||||
|
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.capstone.foodify.ItemTouchHelperListener;
|
||||||
|
|
||||||
|
public class RecyclerViewItemTouchHelperBasketFood extends ItemTouchHelper.SimpleCallback{
|
||||||
|
|
||||||
|
private ItemTouchHelperListener listener;
|
||||||
|
|
||||||
|
public RecyclerViewItemTouchHelperBasketFood(int dragDirs, int swipeDirs, ItemTouchHelperListener listener) {
|
||||||
|
super(dragDirs, swipeDirs);
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
|
if(listener != null)
|
||||||
|
listener.onSwiped(viewHolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
|
||||||
|
if(viewHolder != null){
|
||||||
|
View foreGroundView = ((BasketAdapter.BasketViewHolder) viewHolder).layoutForeGround;
|
||||||
|
getDefaultUIUtil().onSelected(foreGroundView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChildDrawOver(@NonNull Canvas c, @NonNull RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
|
||||||
|
assert viewHolder != null;
|
||||||
|
View foreGroundView = ((BasketAdapter.BasketViewHolder) viewHolder).layoutForeGround;
|
||||||
|
getDefaultUIUtil().onDrawOver(c, recyclerView, foreGroundView, dX, dY, actionState, isCurrentlyActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
|
||||||
|
View foreGroundView = ((BasketAdapter.BasketViewHolder) viewHolder).layoutForeGround;
|
||||||
|
getDefaultUIUtil().onDraw(c, recyclerView, foreGroundView, dX, dY, actionState, isCurrentlyActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearView(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||||
|
View foreGroundView = ((BasketAdapter.BasketViewHolder) viewHolder).layoutForeGround;
|
||||||
|
getDefaultUIUtil().clearView(foreGroundView);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,21 +7,10 @@ public class Food implements Comparable<Food>{
|
|||||||
private String price;
|
private String price;
|
||||||
private String discount;
|
private String discount;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private String shopName;
|
private String shopName;
|
||||||
private String reviewCount;
|
private String reviewCount;
|
||||||
|
|
||||||
public String getReviewCount() {
|
|
||||||
return reviewCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviewCount(String reviewCount) {
|
|
||||||
this.reviewCount = reviewCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Food() {
|
public Food() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Food(String id, String img, String name, String price, String shopName) {
|
public Food(String id, String img, String name, String price, String shopName) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.img = img;
|
this.img = img;
|
||||||
@@ -33,58 +22,51 @@ public class Food implements Comparable<Food>{
|
|||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getImg() {
|
public String getImg() {
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImg(String img) {
|
public void setImg(String img) {
|
||||||
this.img = img;
|
this.img = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrice() {
|
public String getPrice() {
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrice(String price) {
|
public void setPrice(String price) {
|
||||||
this.price = price;
|
this.price = price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDiscount() {
|
public String getDiscount() {
|
||||||
return discount;
|
return discount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiscount(String discount) {
|
public void setDiscount(String discount) {
|
||||||
this.discount = discount;
|
this.discount = discount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
public String getShopName() {
|
public String getShopName() {
|
||||||
return shopName;
|
return shopName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShopName(String shopName) {
|
public void setShopName(String shopName) {
|
||||||
this.shopName = shopName;
|
this.shopName = shopName;
|
||||||
}
|
}
|
||||||
|
public String getReviewCount() {
|
||||||
|
return reviewCount;
|
||||||
|
}
|
||||||
|
public void setReviewCount(String reviewCount) {
|
||||||
|
this.reviewCount = reviewCount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Food food) {
|
public int compareTo(Food food) {
|
||||||
|
|||||||
@@ -105,26 +105,14 @@ public class FoodFavoriteAdapter extends RecyclerView.Adapter<FoodFavoriteAdapt
|
|||||||
|
|
||||||
FoodApi.apiService.addFoodToFavorite(food).enqueue(new Callback<Food>() {
|
FoodApi.apiService.addFoodToFavorite(food).enqueue(new Callback<Food>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Food> call, Response<Food> response) {
|
public void onResponse(@NonNull Call<Food> call, @NonNull Response<Food> response) {
|
||||||
Toast.makeText(context, "Add successful!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Add successful!", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<Food> call, Throwable t) {
|
public void onFailure(@NonNull Call<Food> call, @NonNull Throwable t) {
|
||||||
Toast.makeText(context, "Error: " + t, Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Error: " + t, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String convertFromStringToJson(Food foodDelete) throws JSONException {
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("id", foodDelete.getId());
|
|
||||||
jsonObject.put("name", foodDelete.getName());
|
|
||||||
jsonObject.put("img", foodDelete.getImg());
|
|
||||||
jsonObject.put("price", foodDelete.getPrice());
|
|
||||||
jsonObject.put("shopName", foodDelete.getShopName());
|
|
||||||
|
|
||||||
return jsonObject.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ public class FoodSearchAdapter extends RecyclerView.Adapter<FoodSearchAdapter.Fo
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FoodViewHolder extends RecyclerView.ViewHolder{
|
public static class FoodViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
|
||||||
private ImageView image;
|
private final ImageView image;
|
||||||
private TextView name, price;
|
private final TextView price, name;
|
||||||
|
|
||||||
public FoodViewHolder(@NonNull View itemView) {
|
public FoodViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.capstone.foodify;
|
package com.capstone.foodify.Model.Food;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -8,13 +8,14 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.capstone.foodify.ItemTouchHelperListener;
|
||||||
import com.capstone.foodify.Model.Food.FoodFavoriteAdapter;
|
import com.capstone.foodify.Model.Food.FoodFavoriteAdapter;
|
||||||
|
|
||||||
public class RecyclerViewItemTouchHelper extends ItemTouchHelper.SimpleCallback{
|
public class RecyclerViewItemTouchHelperFavoriteFood extends ItemTouchHelper.SimpleCallback{
|
||||||
|
|
||||||
private ItemTouchHelperListener listener;
|
private ItemTouchHelperListener listener;
|
||||||
|
|
||||||
public RecyclerViewItemTouchHelper(int dragDirs, int swipeDirs, ItemTouchHelperListener listener) {
|
public RecyclerViewItemTouchHelperFavoriteFood(int dragDirs, int swipeDirs, ItemTouchHelperListener listener) {
|
||||||
super(dragDirs, swipeDirs);
|
super(dragDirs, swipeDirs);
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
import com.capstone.foodify.Fragment.BasketFragment;
|
import com.capstone.foodify.Fragment.BasketFragment;
|
||||||
import com.capstone.foodify.Fragment.FavouriteFragment;
|
import com.capstone.foodify.Fragment.FavoriteFragment;
|
||||||
import com.capstone.foodify.Fragment.HomeFragment;
|
import com.capstone.foodify.Fragment.HomeFragment;
|
||||||
import com.capstone.foodify.Fragment.ProfileFragment;
|
import com.capstone.foodify.Fragment.ProfileFragment;
|
||||||
import com.capstone.foodify.Fragment.SearchFragment;
|
import com.capstone.foodify.Fragment.SearchFragment;
|
||||||
@@ -23,7 +23,7 @@ public class ViewPagerAdapter extends FragmentStateAdapter {
|
|||||||
switch(position) {
|
switch(position) {
|
||||||
case 1: return new SearchFragment();
|
case 1: return new SearchFragment();
|
||||||
case 2: return new BasketFragment();
|
case 2: return new BasketFragment();
|
||||||
case 3: return new FavouriteFragment();
|
case 3: return new FavoriteFragment();
|
||||||
case 4: return new ProfileFragment();
|
case 4: return new ProfileFragment();
|
||||||
default: return new HomeFragment();
|
default: return new HomeFragment();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:text="@string/forgot_password"
|
android:text="@string/forgot_password"
|
||||||
android:textColor="@color/graylight"
|
android:textColor="@color/grayLight"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
@@ -1,14 +1,88 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".Fragment.BasketFragment">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:context=".Fragment.BasketFragment"
|
||||||
|
android:id="@+id/list_basket_food_view"
|
||||||
|
>
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<LinearLayout
|
||||||
<TextView
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="@string/hello_blank_fragment" />
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
</FrameLayout>
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view_basket_food"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:listitem="@layout/item_food_basket"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/cardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
app:cardBackgroundColor="@color/green"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/linearLayout"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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="Tổng cộng: "
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
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:fontFamily="@font/opensans"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnPlaceOrder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="Đặt hàng"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".Fragment.FavouriteFragment"
|
tools:context=".Fragment.FavoriteFragment"
|
||||||
android:id="@+id/list_favorite_food_view"
|
android:id="@+id/list_favorite_food_view"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/sign_up_button"
|
android:id="@+id/sign_up_button"
|
||||||
android:backgroundTint="@color/graylight"
|
android:backgroundTint="@color/grayLight"
|
||||||
android:text="Sign Up"
|
android:text="Sign Up"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:fontFamily="@font/bebas"
|
android:fontFamily="@font/bebas"
|
||||||
@@ -300,7 +300,7 @@
|
|||||||
android:text="Foodify V1.0.0"
|
android:text="Foodify V1.0.0"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:textColor="@color/graylight"
|
android:textColor="@color/grayLight"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
android:text="Foodify Coperation"
|
android:text="Foodify Coperation"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:textColor="@color/graylight"
|
android:textColor="@color/grayLight"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
android:id="@+id/end_of_list_text"
|
android:id="@+id/end_of_list_text"
|
||||||
android:text="End of list"
|
android:text="End of list"
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:textColor="@color/graylight"
|
android:textColor="@color/grayLight"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintTop_toBottomOf="@id/progress_bar"
|
app:layout_constraintTop_toBottomOf="@id/progress_bar"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/red"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:text="@string/delete"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_toStartOf="@id/img_delete"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_delete"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/baseline_delete_24"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<!--Layout foreground-->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_foreground"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="110dp"
|
||||||
|
android:layout_height="110dp"
|
||||||
|
android:src="@drawable/food"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_corner_radius="10dip"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/food_name_text_view"
|
||||||
|
android:text="@string/food_name"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="47dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/image_view"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_weight="0.6"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shop_name_text_view"
|
||||||
|
android:text="Shop Name"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/secondary"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/image_view"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/text_view_1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/price_text_view"
|
||||||
|
android:text="$5.00"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:textColor="@color/primaryColor"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
|
||||||
|
android:id="@+id/quantity"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:backGroundColor="@color/white"
|
||||||
|
app:textColor="@color/primaryColor"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="0.4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -6,7 +6,9 @@
|
|||||||
<color name="primaryColor">#ff8084</color>
|
<color name="primaryColor">#ff8084</color>
|
||||||
<color name="gray">#A3A3A3</color>
|
<color name="gray">#A3A3A3</color>
|
||||||
<color name="secondary">#F99928</color>
|
<color name="secondary">#F99928</color>
|
||||||
<color name="graylight">#ACA5A5</color>
|
<color name="grayLight">#ACA5A5</color>
|
||||||
<color name="red">#FF0000</color>
|
<color name="red">#FF0000</color>
|
||||||
<color name="primaryDark">#1EAE94</color>
|
<color name="primaryDark">#1EAE94</color>
|
||||||
|
<color name="green">#A9d440</color>
|
||||||
|
<color name="darkGreen">#004d40</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -48,4 +48,6 @@
|
|||||||
<string name="account_and_profile">Thông tin tài khoản</string>
|
<string name="account_and_profile">Thông tin tài khoản</string>
|
||||||
<string name="delete">Delete</string>
|
<string name="delete">Delete</string>
|
||||||
<string name="full_name">Họ và tên</string>
|
<string name="full_name">Họ và tên</string>
|
||||||
|
<string name="basket">basket</string>
|
||||||
|
<string name="food_name">Food Name</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:textColorHint">@color/graylight</item>
|
<item name="android:textColorHint">@color/grayLight</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DefaultSolid" parent="Widget.MaterialComponents.Button">
|
<style name="DefaultSolid" parent="Widget.MaterialComponents.Button">
|
||||||
|
|||||||
Reference in New Issue
Block a user