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
+5
View File
@@ -44,4 +44,9 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.smarteist:autoimageslider:1.4.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
}
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#F62D4C"
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="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>
+16
View File
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="22dp"
android:height="22dp"
android:viewportWidth="22"
android:viewportHeight="22">
<path
android:pathData="M5,0L17,0A5,5 0,0 1,22 5L22,17A5,5 0,0 1,17 22L5,22A5,5 0,0 1,0 17L0,5A5,5 0,0 1,5 0z"
android:fillColor="#2FDBBC"/>
<group>
<clip-path
android:pathData="M2,2h18v18h-18z"/>
<path
android:pathData="M13.524,4.578L15.933,8.75H18.5V10.25H17.625L17.057,17.062C17.041,17.25 16.956,17.424 16.818,17.552C16.679,17.679 16.498,17.75 16.31,17.75H5.69C5.502,17.75 5.321,17.679 5.182,17.552C5.044,17.424 4.959,17.25 4.943,17.062L4.374,10.25H3.5V8.75H6.067L8.476,4.578L9.774,5.328L7.799,8.75H14.2L12.226,5.328L13.524,4.578ZM16.119,10.25H5.88L6.38,16.25H15.619L16.119,10.25ZM11.75,11.75V14.75H10.25V11.75H11.75ZM8.75,11.75V14.75H7.25V11.75H8.75ZM14.75,11.75V14.75H13.25V11.75H14.75Z"
android:fillColor="#ffffff"/>
</group>
</vector>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+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>
+2
View File
@@ -30,4 +30,6 @@
<string name="new_password">mật khẩu mới</string>
<string name="hello_guest">Hello, Guest!</string>
<string name="recommend_for_you">Recommend for you</string>
<string name="restaurant">Restaurant</string>
<string name="the_most_popular_food">The most popular food</string>
</resources>
+2 -1
View File
@@ -18,4 +18,5 @@ 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.nonTransitiveRClass=true
android.enableJetifier=true
+1
View File
@@ -9,6 +9,7 @@ dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}