ui: animate selection

Animate the check mark and background change when a item is selected.

This produces a nicer UX overall. If possible, I'm planning to also
port this to the other indicators in ImageGroup, albeit doing that is
signifigantly harder.
This commit is contained in:
Alexander Capehart
2022-12-05 04:25:09 +00:00
parent a02490ae18
commit f5ec295b2c
6 changed files with 45 additions and 9 deletions
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
android:enterFadeDuration="150"
android:exitFadeDuration="150">
<item
android:id="@+id/pressed"
android:state_activated="true">
<shape android:shape="rectangle">
<solid android:color="@color/sel_item_activated_bg" />
</shape>
</item>
<item
android:id="@+id/def">
<shape android:shape="rectangle">
<solid android:color="@color/sel_item_activated_bg" />
</shape>
</item>
</animated-selector>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/sel_activatable_background" />
<item android:drawable="@drawable/sel_item_ripple_bg" />
<item android:drawable="?attr/selectableItemBackground" />
</layer-list>