mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Init data from API to screen, fix some UI
This commit is contained in:
@@ -2,6 +2,7 @@ package com.capstone.foodify.API;
|
||||
|
||||
import com.capstone.foodify.Model.Category.Category;
|
||||
import com.capstone.foodify.Model.Food.Food;
|
||||
import com.capstone.foodify.Model.Food.ImageFood;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
@@ -33,12 +34,18 @@ public interface FoodApi {
|
||||
@GET("listFood")
|
||||
Call<List<Food>> listFood(@Query("search") String search, @Query("page") int page, @Query("limit") int limit);
|
||||
|
||||
@GET("listFood")
|
||||
Call<List<Food>> listFood(@Query("page") int page, @Query("limit") int limit);
|
||||
|
||||
@GET("Category")
|
||||
Call<List<Category>> listCategory();
|
||||
|
||||
@GET("Category/{id}/food")
|
||||
Call<List<Food>> listFoodByCategory(@Path("id") String id);
|
||||
|
||||
@GET("listFood")
|
||||
Call<List<Food>> listFoodByPagination(@Query("page") int page, @Query("limit") int limit);
|
||||
@GET("detail/{id}")
|
||||
Call<Food> detailFood(@Path("id") String id);
|
||||
|
||||
@GET("detail/{id}/image")
|
||||
Call<List<ImageFood>> getImageFoodById(@Path("id") String id);
|
||||
}
|
||||
|
||||
@@ -4,23 +4,50 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.Model.Food.Food;
|
||||
import com.capstone.foodify.Model.Food.ImageFood;
|
||||
import com.capstone.foodify.R;
|
||||
import com.denzcoskun.imageslider.ImageSlider;
|
||||
import com.denzcoskun.imageslider.constants.ScaleTypes;
|
||||
import com.denzcoskun.imageslider.models.SlideModel;
|
||||
import com.mcdev.quantitizerlibrary.AnimationStyle;
|
||||
import com.mcdev.quantitizerlibrary.HorizontalQuantitizer;
|
||||
import com.mcdev.quantitizerlibrary.QuantitizerListener;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class FoodDetailActivity extends AppCompatActivity {
|
||||
|
||||
HorizontalQuantitizer horizontalQuantitizer;
|
||||
ImageSlider imageSlider;
|
||||
ImageView back_image;
|
||||
private HorizontalQuantitizer horizontalQuantitizer;
|
||||
private ImageSlider imageSlider;
|
||||
private ImageView back_image, favourite_icon;
|
||||
private String foodId = "";
|
||||
private Food food;
|
||||
private static 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 ProgressBar progressBar;
|
||||
private Button add_to_basket_button;
|
||||
private LinearLayout linearLayout, linearLayout2, linearLayout3;
|
||||
private View line;
|
||||
private float totalPrice, price;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -31,19 +58,53 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
horizontalQuantitizer = findViewById(R.id.quantity_option);
|
||||
imageSlider = findViewById(R.id.slider);
|
||||
back_image = findViewById(R.id.back_image);
|
||||
foodName_txt = findViewById(R.id.food_name_text_view);
|
||||
shopName_txt = findViewById(R.id.shop_name_text_view);
|
||||
discount_txt = findViewById(R.id.discount);
|
||||
description_txt = findViewById(R.id.description_text_view);
|
||||
price_txt = findViewById(R.id.price);
|
||||
progressBar = findViewById(R.id.progress_bar);
|
||||
add_to_basket_button = findViewById(R.id.add_to_basket_button);
|
||||
linearLayout = findViewById(R.id.linear_layout_1);
|
||||
linearLayout2 = findViewById(R.id.linear_layout_2);
|
||||
linearLayout3 = findViewById(R.id.linear_layout_3);
|
||||
favourite_icon = findViewById(R.id.favorite_icon);
|
||||
line = findViewById(R.id.line);
|
||||
total_txt = findViewById(R.id.total_text_view);
|
||||
countRating_txt = findViewById(R.id.count_rating_text_view);
|
||||
description_content_txt = findViewById(R.id.content_description_text_view);
|
||||
hideUI();
|
||||
|
||||
//Customize UI Horizontal Quantitizer
|
||||
horizontalQuantitizer.setTextAnimationStyle(AnimationStyle.SLIDE_IN_REVERSE);
|
||||
horizontalQuantitizer.setPlusIconBackgroundColor(R.color.white);
|
||||
horizontalQuantitizer.setMinusIconBackgroundColor(R.color.white);
|
||||
|
||||
List<SlideModel> slideModels = new ArrayList<>();
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/basil-minced-pork-with-rice-fried-egg.jpg?alt=media&token=838ea008-5525-44fb-a5b0-cf77877184a8", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/delicious-vietnamese-food-including-pho-ga-noodles-spring-rolls-white-table.jpg?alt=media&token=c19919c7-f69d-4933-b955-3fa627e411a0", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/fried-spring-rolls-cutting-board.jpg?alt=media&token=a2f64b21-578c-427f-bbc8-767280ee82e0", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/pieces-chicken-fillet-with-mushrooms-stewed-tomato-sauce-with-boiled-broccoli-rice-proper-nutrition-healthy-lifestyle-dietetic-menu-top-view.jpg?alt=media&token=deded3b6-db7b-4a8d-9720-66ddef916d6f", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/top-view-fresh-delicious-vietnamese-food-table.jpg?alt=media&token=eec8a996-2a12-4b47-b369-8d4d1e91b20a", null));
|
||||
horizontalQuantitizer.setQuantitizerListener(new QuantitizerListener() {
|
||||
@Override
|
||||
public void onIncrease() {
|
||||
}
|
||||
|
||||
imageSlider.setImageList(slideModels, ScaleTypes.FIT);
|
||||
@Override
|
||||
public void onDecrease() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(int i) {
|
||||
Locale locale = new Locale("vi", "VN");
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
|
||||
if(totalPrice >= 0)
|
||||
totalPrice = price * i;
|
||||
add_to_basket_button.setText("Add to basket - " + fmt.format(totalPrice));
|
||||
}
|
||||
});
|
||||
|
||||
//Get data
|
||||
if(getIntent() != null)
|
||||
foodId = getIntent().getStringExtra("FoodId");
|
||||
|
||||
getImageFoodById(foodId);
|
||||
|
||||
back_image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -52,4 +113,107 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void hideUI() {
|
||||
horizontalQuantitizer.setVisibility(View.GONE);
|
||||
imageSlider.setVisibility(View.GONE);
|
||||
back_image.setVisibility(View.GONE);
|
||||
shopName_txt.setVisibility(View.GONE);
|
||||
description_txt.setVisibility(View.GONE);
|
||||
price_txt.setVisibility(View.GONE);
|
||||
add_to_basket_button.setVisibility(View.GONE);
|
||||
linearLayout.setVisibility(View.GONE);
|
||||
linearLayout2.setVisibility(View.GONE);
|
||||
linearLayout3.setVisibility(View.GONE);
|
||||
line.setVisibility(View.GONE);
|
||||
total_txt.setVisibility(View.GONE);
|
||||
description_content_txt.setVisibility(View.GONE);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void showUI() {
|
||||
horizontalQuantitizer.setVisibility(View.VISIBLE);
|
||||
imageSlider.setVisibility(View.VISIBLE);
|
||||
back_image.setVisibility(View.VISIBLE);
|
||||
shopName_txt.setVisibility(View.VISIBLE);
|
||||
description_txt.setVisibility(View.VISIBLE);
|
||||
price_txt.setVisibility(View.VISIBLE);
|
||||
add_to_basket_button.setVisibility(View.VISIBLE);
|
||||
linearLayout.setVisibility(View.VISIBLE);
|
||||
linearLayout2.setVisibility(View.VISIBLE);
|
||||
linearLayout3.setVisibility(View.VISIBLE);
|
||||
line.setVisibility(View.VISIBLE);
|
||||
total_txt.setVisibility(View.VISIBLE);
|
||||
description_content_txt.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void initData(){
|
||||
Locale locale = new Locale("vi", "VN");
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
|
||||
price = Float.parseFloat(food.getPrice());
|
||||
|
||||
foodName_txt.setText(food.getName());
|
||||
shopName_txt.setText("Shop Name");
|
||||
price_txt.setText(fmt.format(Float.parseFloat(food.getPrice())));
|
||||
discount_txt.setText("-" + food.getDiscount() + "%");
|
||||
description_content_txt.setText(food.getDescription());
|
||||
countRating_txt.setText(food.getReviewCount());
|
||||
|
||||
add_to_basket_button.setText("ADD TO BASKET - " + fmt.format(0));
|
||||
|
||||
List<SlideModel> slideModels = new ArrayList<>();
|
||||
if(imageFood != null){
|
||||
for(String imageUrl: imageFood)
|
||||
slideModels.add(new SlideModel(imageUrl, null));
|
||||
}
|
||||
imageSlider.setImageList(slideModels, ScaleTypes.FIT);
|
||||
|
||||
}
|
||||
|
||||
private void getFoodById(String foodId){
|
||||
FoodApi.apiService.detailFood(foodId).enqueue(new Callback<Food>() {
|
||||
@Override
|
||||
public void onResponse(Call<Food> call, Response<Food> response) {
|
||||
Food tempFood = response.body();
|
||||
if(tempFood != null)
|
||||
food = tempFood;
|
||||
|
||||
initData();
|
||||
showUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Food> call, Throwable t) {
|
||||
Toast.makeText(FoodDetailActivity.this, "Lỗi Food" + t, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getImageFoodById(String foodId) {
|
||||
FoodApi.apiService.getImageFoodById(foodId).enqueue(new Callback<List<ImageFood>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<ImageFood>> call, Response<List<ImageFood>> response) {
|
||||
List<ImageFood> imageFoodData = response.body();
|
||||
if (imageFoodData != null){
|
||||
imageFood.clear();
|
||||
for(ImageFood imageFoodTemp: imageFoodData){
|
||||
imageFood.add(imageFoodTemp.getImageUrl());
|
||||
}
|
||||
}
|
||||
|
||||
getFoodById(foodId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<List<ImageFood>> call, Throwable t) {
|
||||
Toast.makeText(FoodDetailActivity.this, "Lỗi Image" + t, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ public class HomeFragment extends Fragment {
|
||||
recyclerView_restaurant = view.findViewById(R.id.recycler_view_restaurant);
|
||||
shopAdapter = new ShopAdapter(getContext());
|
||||
|
||||
|
||||
if(listFood.isEmpty() || drinkFood.isEmpty()){
|
||||
getListFood();
|
||||
} else {
|
||||
|
||||
@@ -2,13 +2,10 @@ package com.capstone.foodify.Fragment;
|
||||
|
||||
import static com.capstone.foodify.Fragment.HomeFragment.listFood;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
@@ -23,7 +20,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.Model.Category.Category;
|
||||
import com.capstone.foodify.Model.Food.Food;
|
||||
import com.capstone.foodify.Model.Food.FoodAdapter;
|
||||
import com.capstone.foodify.Model.Food.FoodSearchAdapter;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.chip.Chip;
|
||||
@@ -31,7 +27,6 @@ import com.google.android.material.chip.ChipGroup;
|
||||
import com.paulrybitskyi.persistentsearchview.PersistentSearchView;
|
||||
import com.paulrybitskyi.persistentsearchview.listeners.OnSearchConfirmedListener;
|
||||
import com.paulrybitskyi.persistentsearchview.listeners.OnSearchQueryChangeListener;
|
||||
import com.paulrybitskyi.persistentsearchview.utils.VoiceRecognitionDelegate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -219,7 +214,7 @@ public class SearchFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void getListFoodByPagination(int page){
|
||||
FoodApi.apiService.listFoodByPagination(page, LIMIT).enqueue(new Callback<List<Food>>() {
|
||||
FoodApi.apiService.listFood(page, LIMIT).enqueue(new Callback<List<Food>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<Food>> call, Response<List<Food>> response) {
|
||||
loadFoodAdapter(response);
|
||||
|
||||
@@ -5,6 +5,18 @@ public class Food {
|
||||
private String img;
|
||||
private String name;
|
||||
private String price;
|
||||
private String discount;
|
||||
private String description;
|
||||
|
||||
private String reviewCount;
|
||||
|
||||
public String getReviewCount() {
|
||||
return reviewCount;
|
||||
}
|
||||
|
||||
public void setReviewCount(String reviewCount) {
|
||||
this.reviewCount = reviewCount;
|
||||
}
|
||||
|
||||
public Food() {
|
||||
}
|
||||
@@ -33,7 +45,6 @@ public class Food {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
@@ -42,14 +53,19 @@ public class Food {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Food{" +
|
||||
"id='" + id + '\'' +
|
||||
", img='" + img + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", price='" + price + '\'' +
|
||||
'}';
|
||||
public void setDiscount(String discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ import com.capstone.foodify.Activity.FoodDetailActivity;
|
||||
import com.capstone.foodify.R;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder>{
|
||||
|
||||
@@ -37,15 +39,6 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
@Override
|
||||
public FoodViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_foods, parent, false);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(parent.getContext(), FoodDetailActivity.class);
|
||||
parent.getContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
return new FoodViewHolder(view);
|
||||
}
|
||||
|
||||
@@ -56,16 +49,29 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
return;
|
||||
}
|
||||
|
||||
Locale locale = new Locale("vi", "VN");
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
|
||||
String foodName = food.getName();
|
||||
if(foodName.length() >= 19){
|
||||
if(foodName.length() >= 30){
|
||||
StringBuilder stringBuilder = new StringBuilder(food.getName());
|
||||
stringBuilder.replace(19, food.getName().length(), "..." );
|
||||
stringBuilder.replace(30, food.getName().length(), "..." );
|
||||
holder.name.setText(stringBuilder);
|
||||
} else {
|
||||
holder.name.setText(foodName);
|
||||
}
|
||||
Picasso.get().load(food.getImg()).into(holder.image);
|
||||
holder.price.setText(food.getPrice());
|
||||
holder.price.setText(fmt.format(Float.parseFloat(food.getPrice())));
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(context, FoodDetailActivity.class);
|
||||
intent.putExtra("FoodId", food.getId());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.capstone.foodify.Model.Food;
|
||||
|
||||
public class ImageFood {
|
||||
private String imageUrl;
|
||||
private String id;
|
||||
private String detailId;
|
||||
|
||||
public ImageFood(String imageUrl, String id, String detailId) {
|
||||
this.imageUrl = imageUrl;
|
||||
this.id = id;
|
||||
this.detailId = detailId;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDetailId() {
|
||||
return detailId;
|
||||
}
|
||||
|
||||
public void setDetailId(String detailId) {
|
||||
this.detailId = detailId;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.MenuViewHolder
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, RecyclerView.HORIZONTAL, false);
|
||||
holder.rcvFood.setLayoutManager(linearLayoutManager);
|
||||
|
||||
FoodAdapter foodAdapter = new FoodAdapter();
|
||||
FoodAdapter foodAdapter = new FoodAdapter(context);
|
||||
foodAdapter.setData(menu.getFoods());
|
||||
|
||||
holder.rcvFood.setAdapter(foodAdapter);
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout"
|
||||
android:id="@+id/linear_layout_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -117,7 +117,7 @@
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_layout"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_layout_1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -190,7 +191,8 @@
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:text="Total"
|
||||
android:id="@+id/total_text_view"
|
||||
android:text="Price"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
@@ -200,6 +202,7 @@
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/price"
|
||||
android:text="25.000 VND"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/primaryColor"
|
||||
@@ -228,6 +231,7 @@
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#c0c0c0"
|
||||
@@ -273,9 +277,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|center_vertical"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="130dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="221dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="131dp"
|
||||
android:layout_height="131dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:src="@drawable/food"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_corner_radius="10dip"
|
||||
@@ -31,7 +31,7 @@
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/food_title"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
@@ -57,32 +57,38 @@
|
||||
<TextView
|
||||
android:id="@+id/price"
|
||||
android:textSize="18sp"
|
||||
android:text="100.000"
|
||||
android:text="1000000000"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.55"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:text="-59%"
|
||||
android:textSize="8sp"
|
||||
android:textColor="@color/red"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/basket_icon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="0.18"
|
||||
android:layout_marginTop="3dp"
|
||||
android:contentDescription="@string/basket_icon"
|
||||
android:src="@drawable/basket_icon" />
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/basket_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:contentDescription="@string/basket_icon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/basket_icon"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user