Show recipe info in bottom sheet dialog

This commit is contained in:
Kirill Kamakin
2021-11-25 20:06:53 +03:00
parent 6c41c4fcf6
commit e701b5d7df
5 changed files with 36 additions and 29 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners
android:topLeftRadius="@dimen/rounded_corner_size_default"
android:topRightRadius="@dimen/rounded_corner_size_default" />
</shape>

View File

@@ -10,10 +10,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image"
android:scaleType="centerCrop"
android:layout_width="0dp"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded"
android:layout_height="@dimen/fragment_recipe_info_image_height"
android:layout_marginBottom="@dimen/margin_small"
android:contentDescription="@string/content_description_fragment_recipe_info_image"

View File

@@ -30,23 +30,18 @@
android:id="@+id/action_recipesFragment_to_recipeInfoFragment"
app:destination="@id/recipeInfoFragment" />
</fragment>
<fragment
<dialog
android:id="@+id/recipeInfoFragment"
android:name="gq.kirmanak.mealient.ui.recipes.info.RecipeInfoFragment"
android:label="RecipeInfoFragment"
tools:layout="@layout/fragment_recipe_info">
<action
android:id="@+id/action_recipeInfoFragment_to_authenticationFragment"
app:destination="@id/authenticationFragment"
app:popUpTo="@id/nav_graph"
app:popUpToInclusive="true" />
<argument
android:name="recipe_slug"
app:argType="string" />
<argument
android:name="recipe_id"
app:argType="long" />
</fragment>
</dialog>
<fragment
android:id="@+id/disclaimerFragment"
android:name="gq.kirmanak.mealient.ui.disclaimer.DisclaimerFragment"

View File

@@ -12,4 +12,21 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_margin">@dimen/margin_small</item>
</style>
<style name="ShapeAppearance.AllCornersRounded" parent="ShapeAppearance.MaterialComponents">
<item name="cornerSize">@dimen/rounded_corner_size_default</item>
</style>
<!-- This is a workaround to support always round corners of the bottom sheet
See more at https://github.com/material-components/material-components-android/pull/437#issuecomment-852461685 -->
<style name="NoShapeBottomSheetDialog" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
<item name="bottomSheetStyle">@style/NoShapeBottomSheet</item>
</style>
<style name="NoShapeBottomSheet" parent="Widget.MaterialComponents.BottomSheet.Modal">
<item name="shapeAppearance">@null</item>
<item name="shapeAppearanceOverlay">@null</item>
<item name="behavior_fitToContents">false</item>
<item name="android:background">@drawable/recipe_info_background</item>
</style>
</resources>