forked from organicmaps/organicmaps
[android] Use material3 style for bottom sheet
Signed-off-by: Arnaud Vergnet <arnaud.vergnet@mailo.com>
This commit is contained in:
parent
e0cb2b42a6
commit
97a76c2961
7 changed files with 20 additions and 28 deletions
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="100%"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toYDelta="0" />
|
||||
</set>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toYDelta="100%" />
|
||||
</set>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -13,9 +12,8 @@
|
|||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:text="Title"
|
||||
style="@style/MwmTextAppearance.Title"
|
||||
android:textSize="20sp" />
|
||||
android:textAppearance="?fontHeadline6"
|
||||
tools:text="Title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/bottomSheetMenuContainer"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
app:tint="?android:textColorSecondary"/>
|
||||
<TextView
|
||||
android:id="@+id/bottom_sheet_menu_item_text"
|
||||
style="@style/MwmTextAppearance.Body1"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
|
||||
<style name="MwmWidget.Downloader"/>
|
||||
|
||||
<style name="BottomSheetAnimation">
|
||||
<item name="android:windowEnterAnimation">@anim/slide_in_up</item>
|
||||
<item name="android:windowExitAnimation">@anim/slide_out_down</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MwmWidget.MapButton" parent="android:Widget.ImageButton">
|
||||
<item name="android:scaleType">center</item>
|
||||
<item name="android:layout_height">64dp</item>
|
||||
|
|
|
@ -144,6 +144,14 @@
|
|||
|
||||
<style name="MwmTheme.Editor"/>
|
||||
|
||||
<style name="MwmTheme.BottomSheetDialog" parent="Theme.Material3.Light.BottomSheetDialog">
|
||||
<item name="colorSurface">@color/bg_cards</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmTheme.Night.BottomSheetDialog" parent="Theme.Material3.Dark.BottomSheetDialog" >
|
||||
<item name="colorSurface">@color/bg_cards_night</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmTheme.Downloader">
|
||||
<item name="status_done">@drawable/ic_downloader_done</item>
|
||||
<item name="status_downloadable">@drawable/ic_downloader_download</item>
|
||||
|
|
|
@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -35,6 +36,14 @@ public class MenuBottomSheetFragment extends BottomSheetDialogFragment
|
|||
this.menuBottomSheetItems = menuBottomSheetItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTheme()
|
||||
{
|
||||
return ThemeUtils.isNightTheme(requireContext())
|
||||
? R.style.MwmTheme_Night_BottomSheetDialog
|
||||
: R.style.MwmTheme_BottomSheetDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
|
@ -75,6 +84,5 @@ public class MenuBottomSheetFragment extends BottomSheetDialogFragment
|
|||
MenuAdapter menuAdapter = new MenuAdapter(menuBottomSheetItems, this::dismiss);
|
||||
recyclerView.setAdapter(menuAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
|
||||
requireDialog().getWindow().getAttributes().windowAnimations = R.style.BottomSheetAnimation;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue