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
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.12" android:color="?attr/colorPrimary" android:state_activated="true"/>
<item android:color="?attr/colorSurface" />
</selector>
@@ -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>
@@ -5,9 +5,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/spacing_mid_large"
android:paddingStart="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_mid_large"
android:paddingEnd="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_medium">
<org.oxycblt.auxio.image.ImageGroup