[android] Display overlay layer state with icon

Fixes #1402

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond
2025-08-17 22:47:48 +01:00
committed by Konstantin Pastbin
parent 4232de04ac
commit d44f0ae7da
6 changed files with 19 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ public class LayersButton extends FloatingActionButton
{
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
if (mAreLayersActive)
mergeDrawableStates(drawableState, new int[] {R.attr.layers_enabled});
mergeDrawableStates(drawableState, new int[] {R.attr.state_layers_enabled});
return drawableState;
}

View File

@@ -9,7 +9,7 @@
android:state_checked="true"/>
<item android:color="@color/base_accent"
app:layers_enabled="true"/>
app:state_layers_enabled="true"/>
<item android:color="@color/icon_tint"/>
</selector>

View File

@@ -9,7 +9,7 @@
android:state_checked="true"/>
<item android:color="@color/base_accent_night"
app:layers_enabled="true"/>
app:state_layers_enabled="true"/>
<item android:color="@color/white_secondary"/>
</selector>

View File

@@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M11.99,18.54l-7.37,-5.73L3,14.07l9,7 9,-7 -1.63,-1.27 -7.38,5.74zM12,16l7.36,-5.73L21,9l-9,-7 -9,7 1.63,1.27L12,16z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
app:state_layers_enabled="true"
android:drawable="@drawable/ic_layers_clear"/>
<item
app:state_layers_enabled="false"
android:drawable="@drawable/ic_layers_default"/>
</selector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M11.99,18.54l-7.37,-5.73L3,14.07l9,7 9,-7 -1.63,-1.27 -7.38,5.74zM12,16l7.36,-5.73L21,9l-9,-7 -9,7 1.63,1.27L12,16z"/>
</vector>

View File

@@ -28,7 +28,7 @@
</declare-styleable>
<declare-styleable name="layersButton">
<attr name="layers_enabled" format="boolean"/>
<attr name="state_layers_enabled" format="boolean"/>
</declare-styleable>
<declare-styleable name="PlacePageView">