Swipe to delete in favorite screen

This commit is contained in:
Nezumi
2023-03-02 17:26:43 +07:00
parent d895d7e4da
commit 71d24ef9dd
10 changed files with 375 additions and 124 deletions
@@ -0,0 +1,5 @@
<vector android:height="32dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>
@@ -4,7 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.FavouriteFragment">
tools:context=".Fragment.FavouriteFragment"
android:id="@+id/list_favorite_food_view"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -26,7 +28,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_favorite_food"
tools:listitem="@layout/item_food_horizontal"
tools:listitem="@layout/item_food_favorite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
@@ -0,0 +1,126 @@
<?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="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<TextView
android:id="@+id/food_name_text_view"
android:text="Food Name"
android:textSize="18sp"
android:textColor="@color/black"
android:fontFamily="@font/opensans"
android:layout_width="wrap_content"
android:layout_height="47dp"
android:layout_marginStart="12dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
/>
<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_marginStart="12dp"
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_marginStart="12dp"
android:layout_marginTop="2dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1"
>
<ImageView
android:id="@+id/basket_icon"
android:layout_width="20dp"
android:layout_height="match_parent"
android:contentDescription="@string/basket_icon"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/basket_icon"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
>
<androidx.cardview.widget.CardView
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:cardMaxElevation="10dp"
app:cardPreventCornerOverlap="true"
app:cardElevation="3dp"
app:cardCornerRadius="10dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<com.makeramen.roundedimageview.RoundedImageView
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"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<TextView
android:id="@+id/text_view_1"
android:text="Food Name"
android:textSize="18sp"
android:textColor="@color/black"
android:fontFamily="@font/opensans"
android:layout_width="wrap_content"
android:layout_height="47dp"
android:layout_marginStart="12dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:id="@+id/text_view_2"
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_marginStart="12dp"
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
/>
<TextView
android:id="@+id/text_price"
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_marginStart="12dp"
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_2"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1"
>
<ImageView
android:id="@+id/basket_icon"
android:layout_width="20dp"
android:layout_height="match_parent"
android:contentDescription="@string/basket_icon"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/basket_icon"
/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+1
View File
@@ -46,4 +46,5 @@
<string name="old_password">Mật khẩu cũ</string>
<string name="change_password">Đổi mật khẩu</string>
<string name="account_and_profile">Thông tin tài khoản</string>
<string name="delete">Delete</string>
</resources>