Add list food to Home Fragment

This commit is contained in:
Nezumi
2023-02-11 13:02:00 +07:00
parent ac66307478
commit bbf7dfd68b
15 changed files with 233 additions and 1 deletions
+74
View File
@@ -86,6 +86,80 @@
app:layout_constraintStart_toStartOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_food"
android:layout_width="0dp"
android:layout_height="251dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal"
tools:listitem="@layout/list_foods"
app:layout_constraintTop_toBottomOf="@id/recommend_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<TextView
android:id="@+id/restaurant_text"
android:text="@string/restaurant"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginStart="20dp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/recycler_view_food"
app:layout_constraintStart_toStartOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_restaurant"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal"
android:contentDescription="List Food"
tools:listitem="@layout/list_restaurant"
app:layout_constraintTop_toBottomOf="@id/restaurant_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<TextView
android:id="@+id/the_most_popular_food_text"
android:text="@string/the_most_popular_food"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginStart="20dp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/recycler_view_restaurant"
app:layout_constraintStart_toStartOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_food_most_popular"
android:layout_width="0dp"
android:layout_height="251dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal"
tools:listitem="@layout/list_foods"
app:layout_constraintTop_toBottomOf="@id/the_most_popular_food_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
+94
View File
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="157dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="230dp"
app:cardCornerRadius="10dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/image_view"
android:layout_width="157dp"
android:layout_height="157dp"
android:src="@drawable/food"
android:scaleType="centerCrop"
app:riv_corner_radius="10dip"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<ImageView
android:id="@+id/favourite_icon"
android:src="@drawable/baseline_favorite_border_24"
android:layout_width="18dp"
android:layout_height="20dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="2dp"
app:layout_constraintEnd_toEndOf="@id/image_view"
app:layout_constraintBottom_toBottomOf="@id/image_view"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Food Title"
android:layout_marginStart="6dp"
android:textSize="16sp"
android:fontFamily="@font/opensans"
android:textColor="@color/black"
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@+id/image_view"
app:layout_constraintStart_toStartOf="parent"
/>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="2dp"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintStart_toStartOf="parent"
>
<TextView
android:id="@+id/price_textview"
android:text="$ 5.00"
android:textSize="20sp"
android:textColor="@color/primaryColor"
android:fontFamily="@font/bebas"
android:layout_marginStart="6dp"
android:layout_width="0dp"
android:layout_weight="0.7"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/basket_icon"
android:src="@drawable/basket_icon"
android:layout_marginTop="4dp"
android:layout_width="0dp"
android:layout_weight="0.2"
android:layout_height="20dp"
android:layout_marginEnd="2dp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="80dp"
android:layout_height="80dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="10dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="10dp"
android:layout_margin="2dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:src="@drawable/burgerking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>