Explorar o código

Fix checked state for manga header buttons

arkon %!s(int64=4) %!d(string=hai) anos
pai
achega
8ba426350f

+ 5 - 0
app/src/main/res/color/outlined_button_bg.xml

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

+ 4 - 0
app/src/main/res/color/outlined_button_stroke.xml

@@ -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.12" android:color="?attr/colorOnSurface" />
+</selector>

+ 2 - 0
app/src/main/res/layout/manga_info_header.xml

@@ -128,6 +128,7 @@
                     style="@style/Theme.Widget.Button.Icon"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:checkable="true"
                     android:text="@string/add_to_library"
                     app:icon="@drawable/ic_favorite_border_24dp" />
 
@@ -137,6 +138,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginStart="8dp"
+                    android:checkable="true"
                     android:text="@string/manga_tracking_tab"
                     android:visibility="gone"
                     app:icon="@drawable/ic_sync_24dp"

+ 5 - 2
app/src/main/res/values/styles.xml

@@ -264,9 +264,12 @@
         <item name="textAllCaps">false</item>
         <item name="cornerRadius">16dp</item>
 
-        <item name="iconTint">?colorAccent</item>
-        <item name="rippleColor">?colorAccent</item>
+        <item name="iconTint">?attr/colorAccent</item>
+        <item name="rippleColor">?attr/colorAccent</item>
         <item name="android:textColor">?attr/colorOnBackground</item>
+
+        <item name="backgroundTint">@color/outlined_button_bg</item>
+        <item name="strokeColor">@color/outlined_button_stroke</item>
     </style>
 
     <style name="Theme.Widget.Button.Icon.Textless">