diff --git a/app/src/main/java/com/example/getfood/Adapter/MenuDisplayAdapter.java b/app/src/main/java/com/example/getfood/Adapter/MenuDisplayAdapter.java index db18f2e..6c6c8a8 100644 --- a/app/src/main/java/com/example/getfood/Adapter/MenuDisplayAdapter.java +++ b/app/src/main/java/com/example/getfood/Adapter/MenuDisplayAdapter.java @@ -15,15 +15,17 @@ public class MenuDisplayAdapter extends BaseAdapter { ArrayList itemName,itemPrice, itemRating; + ArrayList colors; Context context; LayoutInflater inflater; TextView itemNameTextView, itemPriceTextView, itemRatingTextView; - public MenuDisplayAdapter(ArrayList itemName, ArrayList itemPrice, ArrayList itemRating, Context context) { + public MenuDisplayAdapter(ArrayList itemName, ArrayList itemPrice, ArrayList itemRating, ArrayList colors, Context context) { this.itemName = itemName; this.itemPrice = itemPrice; this.itemRating = itemRating; + this.colors = colors; this.context = context; this.inflater = LayoutInflater.from(context); } @@ -55,11 +57,11 @@ public View getView(int i, View view, ViewGroup viewGroup) { itemPriceTextView.setText(String.format("₹ %s", itemPrice.get(i))); itemRatingTextView.setText(itemRating.get(i)); if(Float.valueOf(itemRating.get(i))<2.0){ - itemRatingTextView.setTextColor(Color.RED); + itemRatingTextView.setTextColor(colors.get(2)); } else if(Float.valueOf(itemRating.get(i))<3.5){ - itemRatingTextView.setTextColor(Color.YELLOW); + itemRatingTextView.setTextColor(colors.get(1)); } else{ - itemRatingTextView.setTextColor(Color.GREEN); + itemRatingTextView.setTextColor(colors.get(0)); } return vi; diff --git a/app/src/main/java/com/example/getfood/Fragment/ChineseFragment.java b/app/src/main/java/com/example/getfood/Fragment/ChineseFragment.java index 216c492..61f5513 100644 --- a/app/src/main/java/com/example/getfood/Fragment/ChineseFragment.java +++ b/app/src/main/java/com/example/getfood/Fragment/ChineseFragment.java @@ -32,6 +32,7 @@ public class ChineseFragment extends Fragment { private DatabaseReference rootFood; ProgressDialog progressDialog; ArrayList itemName, itemPrice, itemRating; + ArrayList colors; Button alertPlus, alertMinus; TextView quantitySetTV; @@ -55,6 +56,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, itemName = new ArrayList<>(); itemPrice = new ArrayList<>(); itemRating = new ArrayList<>(); + colors = new ArrayList<>(); + + colors.add(getResources().getColor(R.color.colorGoodRating)); + colors.add(getResources().getColor(R.color.colorMediumRating)); + colors.add(getResources().getColor(R.color.colorBadRating)); chineseDisplayListView = v.findViewById(R.id.chineseDisplayListView); final String CATEGORY = "Chinese"; @@ -75,7 +81,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { itemRating.add(dsp.child("Rating").getValue().toString()); } } - displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, getContext()); + displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, colors, getContext()); chineseDisplayListView.setAdapter(displayAdapter); // progressDialog.hide(); diff --git a/app/src/main/java/com/example/getfood/Fragment/PizzaSandwichFragment.java b/app/src/main/java/com/example/getfood/Fragment/PizzaSandwichFragment.java index 8d6f314..203b70c 100644 --- a/app/src/main/java/com/example/getfood/Fragment/PizzaSandwichFragment.java +++ b/app/src/main/java/com/example/getfood/Fragment/PizzaSandwichFragment.java @@ -32,6 +32,7 @@ public class PizzaSandwichFragment extends Fragment { ProgressDialog progressDialog; private String CATEGORY = "Pizza Sandwich"; ArrayList itemName, itemPrice, itemRating; + ArrayList colors; Button alertPlus, alertMinus; TextView quantitySetTV; @@ -56,6 +57,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, itemName = new ArrayList<>(); itemPrice = new ArrayList<>(); itemRating = new ArrayList<>(); + colors = new ArrayList<>(); + + colors.add(getResources().getColor(R.color.colorGoodRating)); + colors.add(getResources().getColor(R.color.colorMediumRating)); + colors.add(getResources().getColor(R.color.colorBadRating)); pizzaSandwichDisplayListView = v.findViewById(R.id.pizzaSandwichDisplayListView); // display progress dialog till data is fetched // progressDialog.setTitle("Please Wait.."); @@ -79,7 +85,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { itemRating.add(dsp.child("Rating").getValue().toString()); } } - displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, getContext()); + displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, colors, getContext()); pizzaSandwichDisplayListView.setAdapter(displayAdapter); // progressDialog.hide(); } diff --git a/app/src/main/java/com/example/getfood/Fragment/SouthIndianFragment.java b/app/src/main/java/com/example/getfood/Fragment/SouthIndianFragment.java index 35fe129..ec49c9f 100644 --- a/app/src/main/java/com/example/getfood/Fragment/SouthIndianFragment.java +++ b/app/src/main/java/com/example/getfood/Fragment/SouthIndianFragment.java @@ -31,6 +31,7 @@ public class SouthIndianFragment extends Fragment { ProgressDialog progressDialog; private String CATEGORY = "South Indian"; ArrayList itemName, itemPrice, itemRating; + ArrayList colors; Button alertPlus, alertMinus; TextView quantitySetTV; @@ -54,6 +55,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, itemName = new ArrayList<>(); itemPrice = new ArrayList<>(); itemRating = new ArrayList<>(); + colors = new ArrayList<>(); + colors.add(getResources().getColor(R.color.colorGoodRating)); + colors.add(getResources().getColor(R.color.colorMediumRating)); + colors.add(getResources().getColor(R.color.colorBadRating)); southIndianDisplayListView = v.findViewById(R.id.southIndianDisplayListView); // display progress dialog till data is fetched // progressDialog.setTitle("Please Wait.."); @@ -78,7 +83,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { } } - displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, getContext()); + displayAdapter = new MenuDisplayAdapter(itemName, itemPrice, itemRating, colors, getContext()); southIndianDisplayListView.setAdapter(displayAdapter); diff --git a/app/src/main/res/layout/cart_display_customlistview.xml b/app/src/main/res/layout/cart_display_customlistview.xml index 5a16965..7f07d98 100644 --- a/app/src/main/res/layout/cart_display_customlistview.xml +++ b/app/src/main/res/layout/cart_display_customlistview.xml @@ -35,14 +35,14 @@ android:id="@+id/itemQuantityTextView" android:layout_width="36dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="64dp" + android:layout_marginStart="4dp" + android:layout_marginBottom="20dp" android:text="0" android:textAlignment="center" android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="#000" - app:layout_constraintStart_toEndOf="@+id/decreaseButton" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/decreaseButton" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" /> #828282 #f1b9b9 #e67e22 + #27ae60 + #e74c3c