Display favorite icon on recipe holders
This commit is contained in:
10
app/src/main/res/drawable/ic_favorite_filled.xml
Normal file
10
app/src/main/res/drawable/ic_favorite_filled.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,21 L10.55,19.7Q8.025,17.425 6.375,15.775Q4.725,14.125 3.75,12.812Q2.775,11.5 2.388,10.4Q2,9.3 2,8.15Q2,5.8 3.575,4.225Q5.15,2.65 7.5,2.65Q8.8,2.65 9.975,3.2Q11.15,3.75 12,4.75Q12.85,3.75 14.025,3.2Q15.2,2.65 16.5,2.65Q18.85,2.65 20.425,4.225Q22,5.8 22,8.15Q22,9.3 21.613,10.4Q21.225,11.5 20.25,12.812Q19.275,14.125 17.625,15.775Q15.975,17.425 13.45,19.7Z" />
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/ic_favorite_unfilled.xml
Normal file
10
app/src/main/res/drawable/ic_favorite_unfilled.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,21 L10.55,19.7Q8.025,17.425 6.375,15.775Q4.725,14.125 3.75,12.812Q2.775,11.5 2.388,10.4Q2,9.3 2,8.15Q2,5.8 3.575,4.225Q5.15,2.65 7.5,2.65Q8.8,2.65 9.975,3.2Q11.15,3.75 12,4.75Q12.85,3.75 14.025,3.2Q15.2,2.65 16.5,2.65Q18.85,2.65 20.425,4.225Q22,5.8 22,8.15Q22,9.3 21.613,10.4Q21.225,11.5 20.25,12.812Q19.275,14.125 17.625,15.775Q15.975,17.425 13.45,19.7ZM12,18.3Q14.4,16.15 15.95,14.612Q17.5,13.075 18.4,11.938Q19.3,10.8 19.65,9.912Q20,9.025 20,8.15Q20,6.65 19,5.65Q18,4.65 16.5,4.65Q15.325,4.65 14.325,5.312Q13.325,5.975 12.95,7H11.05Q10.675,5.975 9.675,5.312Q8.675,4.65 7.5,4.65Q6,4.65 5,5.65Q4,6.65 4,8.15Q4,9.025 4.35,9.912Q4.7,10.8 5.6,11.938Q6.5,13.075 8.05,14.612Q9.6,16.15 12,18.3ZM12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Q12,11.475 12,11.475Z" />
|
||||
</vector>
|
||||
@@ -17,8 +17,7 @@
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?textAppearanceHeadline6"
|
||||
@@ -32,18 +31,27 @@
|
||||
android:id="@+id/image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:layout_marginHorizontal="@dimen/margin_medium"
|
||||
android:contentDescription="@string/content_description_view_holder_recipe_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toTopOf="@+id/name"
|
||||
app:layout_constraintDimensionRatio="2:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/favorite_icon"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:shapeAppearance="?shapeAppearanceCornerMedium"
|
||||
tools:srcCompat="@drawable/placeholder_recipe" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/favorite_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:contentDescription="@string/view_holder_recipe_favorite_content_description"
|
||||
app:layout_constraintBottom_toTopOf="@+id/image"
|
||||
app:layout_constraintEnd_toEndOf="@id/image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@drawable/ic_favorite_unfilled" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -57,4 +57,6 @@
|
||||
<string name="activity_share_recipe_success_toast">Recipe saved successfully.</string>
|
||||
<string name="activity_share_recipe_failure_toast">Something went wrong.</string>
|
||||
<string name="content_description_activity_share_recipe_progress">Progress indicator</string>
|
||||
<string name="view_holder_recipe_favorite_content_description">Item is favorite</string>
|
||||
<string name="view_holder_recipe_non_favorite_content_description">Item is not favorite</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user