Improvements to the new library item selectors (#5379)

* Increase card selector radius

* Add themed overlay to library selector
This commit is contained in:
Soitora 2021-06-12 15:45:26 +02:00 committed by GitHub
parent 73e5e9ecd9
commit 4dfb3cc972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 3 deletions

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.2" android:color="?attr/colorAccent" />
</selector>

View file

@ -10,7 +10,7 @@
android:bottom="2dp" android:bottom="2dp"
android:left="2dp"> android:left="2dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="@dimen/card_radius" /> <corners android:radius="@dimen/card_selector_radius" />
<solid android:color="?attr/colorLibrarySelectionActive" /> <solid android:color="?attr/colorLibrarySelectionActive" />
</shape> </shape>
</item> </item>
@ -22,7 +22,7 @@
android:bottom="2dp" android:bottom="2dp"
android:left="2dp"> android:left="2dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="@dimen/card_radius" /> <corners android:radius="@dimen/card_selector_radius" />
<solid android:color="?attr/colorLibrarySelectionActive" /> <solid android:color="?attr/colorLibrarySelectionActive" />
</shape> </shape>
</item> </item>
@ -33,7 +33,7 @@
android:bottom="2dp" android:bottom="2dp"
android:left="2dp"> android:left="2dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="@dimen/card_radius" /> <corners android:radius="@dimen/card_selector_radius" />
<solid android:color="?android:attr/colorBackground" /> <solid android:color="?android:attr/colorBackground" />
</shape> </shape>
</item> </item>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorLibrarySelection">
<item>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/card_selector_radius" />
<solid android:color="@color/selector_overlay" />
</shape>
</item>
<item android:state_activated="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/card_selector_radius" />
<solid android:color="@color/selector_overlay" />
</shape>
</item>
</selector>
</item>
</ripple>

View file

@ -6,6 +6,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="2dp" android:layout_margin="2dp"
android:background="@drawable/library_item_selector" android:background="@drawable/library_item_selector"
android:foreground="@drawable/library_item_selector_overlay"
android:padding="4dp"> android:padding="4dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout

View file

@ -5,6 +5,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="2dp" android:layout_margin="2dp"
android:background="@drawable/library_item_selector" android:background="@drawable/library_item_selector"
android:foreground="@drawable/library_item_selector_overlay"
android:padding="4dp"> android:padding="4dp">
<FrameLayout <FrameLayout

View file

@ -6,6 +6,7 @@
<dimen name="space_between_cards">4dp</dimen> <dimen name="space_between_cards">4dp</dimen>
<dimen name="card_radius">4dp</dimen> <dimen name="card_radius">4dp</dimen>
<dimen name="card_selector_radius">6dp</dimen>
<dimen name="dialog_radius">8dp</dimen> <dimen name="dialog_radius">8dp</dimen>
<dimen name="fab_size">56dp</dimen> <dimen name="fab_size">56dp</dimen>