Remove custom shapes and elevations

This commit is contained in:
Kirill Kamakin
2022-11-19 10:00:04 +01:00
parent d850c82b6f
commit 4510087209
9 changed files with 16 additions and 56 deletions

View File

@@ -1,6 +1,5 @@
package gq.kirmanak.mealient.ui.recipes.info package gq.kirmanak.mealient.ui.recipes.info
import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@@ -8,10 +7,8 @@ import android.view.ViewGroup
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import by.kirich1409.viewbindingdelegate.viewBinding import by.kirich1409.viewbindingdelegate.viewBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import gq.kirmanak.mealient.R
import gq.kirmanak.mealient.databinding.FragmentRecipeInfoBinding import gq.kirmanak.mealient.databinding.FragmentRecipeInfoBinding
import gq.kirmanak.mealient.logging.Logger import gq.kirmanak.mealient.logging.Logger
import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader
@@ -71,9 +68,6 @@ class RecipeInfoFragment : BottomSheetDialogFragment() {
instructionsAdapter.submitList(uiState.recipeInstructions) instructionsAdapter.submitList(uiState.recipeInstructions)
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
BottomSheetDialog(requireContext(), R.style.NoShapeBottomSheetDialog)
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
logger.v { "onDestroyView() called" } logger.v { "onDestroyView() called" }

View File

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

View File

@@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="?materialCardViewElevatedStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="ui.disclaimer.DisclaimerFragment"> tools:context="ui.disclaimer.DisclaimerFragment">
@@ -12,12 +13,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" android:layout_marginHorizontal="20dp"
android:layout_marginTop="40dp" android:layout_marginTop="40dp"
app:cardElevation="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/okay" app:layout_constraintBottom_toTopOf="@+id/okay"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded"> app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:id="@+id/main_text" android:id="@+id/main_text"
@@ -32,10 +31,10 @@
<Button <Button
android:id="@+id/okay" android:id="@+id/okay"
android:clickable="false"
tools:text="Okay (3 seconds)"
style="@style/SmallMarginButton" style="@style/SmallMarginButton"
android:clickable="false"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/main_text_holder" /> app:layout_constraintTop_toBottomOf="@+id/main_text_holder"
tools:text="Okay (3 seconds)" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -33,15 +33,14 @@
<com.google.android.material.imageview.ShapeableImageView <com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image" android:id="@+id/image"
android:scaleType="centerCrop"
android:layout_width="0dp" android:layout_width="0dp"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded"
android:layout_height="@dimen/fragment_recipe_info_image_height" android:layout_height="@dimen/fragment_recipe_info_image_height"
android:contentDescription="@string/content_description_fragment_recipe_info_image" android:contentDescription="@string/content_description_fragment_recipe_info_image"
android:scaleType="centerCrop"
app:layout_constraintBottom_toTopOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/title"
tools:srcCompat="@drawable/placeholder_recipe" /> tools:srcCompat="@drawable/placeholder_recipe" />
<TextView <TextView
@@ -60,8 +59,8 @@
<TextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_marginHorizontal="8dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:textAppearance="?textAppearanceBody2" android:textAppearance="?textAppearanceBody2"
app:layout_constraintBottom_toTopOf="@+id/ingredients_holder" app:layout_constraintBottom_toTopOf="@+id/ingredients_holder"
@@ -72,13 +71,12 @@
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/ingredients_holder" android:id="@+id/ingredients_holder"
style="?materialCardViewOutlinedStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp" android:layout_marginHorizontal="8dp"
android:layout_marginTop="11dp" android:layout_marginTop="11dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded"
app:cardElevation="10dp"
app:layout_constraintBottom_toTopOf="@+id/instructions_header" app:layout_constraintBottom_toTopOf="@+id/instructions_header"
app:layout_constraintEnd_toStartOf="@+id/end_guide" app:layout_constraintEnd_toStartOf="@+id/end_guide"
app:layout_constraintStart_toEndOf="@+id/start_guide" app:layout_constraintStart_toEndOf="@+id/start_guide"
@@ -133,11 +131,11 @@
android:id="@+id/instructions_list" android:id="@+id/instructions_list"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/end_guide" app:layout_constraintEnd_toStartOf="@+id/end_guide"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/instructions_header"
app:layout_constraintStart_toEndOf="@+id/start_guide" app:layout_constraintStart_toEndOf="@+id/start_guide"
app:layout_constraintTop_toBottomOf="@+id/instructions_header"
tools:itemCount="2" tools:itemCount="2"
tools:listitem="@layout/view_holder_instruction" /> tools:listitem="@layout/view_holder_instruction" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,11 +2,10 @@
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="?materialCardViewOutlinedStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_margin="8dp" android:layout_height="wrap_content"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded" android:layout_margin="8dp">
app:cardElevation="10dp"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -2,13 +2,12 @@
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="?attr/materialCardViewFilledStyle" style="?materialCardViewElevatedStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="7dp" android:layout_marginVertical="7dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="19dp" android:layout_marginEnd="19dp">
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -43,7 +42,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
app:shapeAppearance="@style/ShapeAppearance.AllCornersRounded"
tools:srcCompat="@drawable/placeholder_recipe" /> tools:srcCompat="@drawable/placeholder_recipe" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>

View File

@@ -3,6 +3,4 @@
<dimen name="margin_small">8dp</dimen> <dimen name="margin_small">8dp</dimen>
<dimen name="height_view_holder_recipe_image">182dp</dimen> <dimen name="height_view_holder_recipe_image">182dp</dimen>
<dimen name="fragment_recipe_info_image_height">@dimen/height_view_holder_recipe_image</dimen> <dimen name="fragment_recipe_info_image_height">@dimen/height_view_holder_recipe_image</dimen>
<dimen name="main_activity_toolbar_corner_radius">32dp</dimen>
<dimen name="rounded_corner_size_default">15dp</dimen>
</resources> </resources>

View File

@@ -5,7 +5,6 @@
<string name="fragment_authentication_input_hint_url">Server URL</string> <string name="fragment_authentication_input_hint_url">Server URL</string>
<string name="fragment_authentication_button_login">Login</string> <string name="fragment_authentication_button_login">Login</string>
<string name="content_description_view_holder_recipe_image">Picture of the cooked meal</string> <string name="content_description_view_holder_recipe_image">Picture of the cooked meal</string>
<string name="menu_main_toolbar_content_description_logout" translatable="false">@string/menu_navigation_drawer_logout</string>
<string name="menu_navigation_drawer_logout">Logout</string> <string name="menu_navigation_drawer_logout">Logout</string>
<string name="view_holder_recipe_text_placeholder">Loading…</string> <string name="view_holder_recipe_text_placeholder">Loading…</string>
<string name="content_description_fragment_recipe_info_image" translatable="false">@string/content_description_view_holder_recipe_image</string> <string name="content_description_fragment_recipe_info_image" translatable="false">@string/content_description_view_holder_recipe_image</string>
@@ -18,7 +17,6 @@
<string name="fragment_base_url_malformed_url">Check URL format: %s</string> <string name="fragment_base_url_malformed_url">Check URL format: %s</string>
<string name="fragment_base_url_save">Proceed</string> <string name="fragment_base_url_save">Proceed</string>
<string name="fragment_base_url_unknown_error" translatable="false">@string/fragment_authentication_unknown_error</string> <string name="fragment_base_url_unknown_error" translatable="false">@string/fragment_authentication_unknown_error</string>
<string name="menu_main_toolbar_content_description_login" translatable="false">@string/menu_navigation_drawer_login</string>
<string name="menu_navigation_drawer_login">Login</string> <string name="menu_navigation_drawer_login">Login</string>
<string name="fragment_disclaimer_button_okay">Okay</string> <string name="fragment_disclaimer_button_okay">Okay</string>
<string name="view_holder_recipe_instructions_step">Step: %d</string> <string name="view_holder_recipe_instructions_step">Step: %d</string>

View File

@@ -13,22 +13,6 @@
<item name="android:layout_margin">@dimen/margin_small</item> <item name="android:layout_margin">@dimen/margin_small</item>
</style> </style>
<style name="ShapeAppearance.AllCornersRounded" parent="ShapeAppearance.Material3.LargeComponent">
<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.Material3.BottomSheetDialog">
<item name="bottomSheetStyle">@style/NoShapeBottomSheet</item>
</style>
<style name="NoShapeBottomSheet" parent="Widget.Material3.BottomSheet.Modal">
<item name="shapeAppearance">@null</item>
<item name="shapeAppearanceOverlay">@null</item>
<item name="android:background">@drawable/recipe_info_background</item>
</style>
<style name="IndeterminateProgress"> <style name="IndeterminateProgress">
<item name="android:layout_width">0dp</item> <item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>