set routing buttons colour with xml, not programatically

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond 2024-12-29 17:51:33 +00:00
parent 881e86dd93
commit 3f4721bbd9
10 changed files with 15 additions and 38 deletions

View file

@ -37,10 +37,8 @@ public class RoutingToolbarButton extends AppCompatRadioButton
private void initView()
{
setBackgroundResource(ThemeUtils.isNightTheme(getContext()) ? R.drawable.routing_toolbar_button_night
: R.drawable.routing_toolbar_button);
setButtonTintList(ThemeUtils.isNightTheme(getContext()) ? R.color.routing_toolbar_icon_tint_night
: R.color.routing_toolbar_icon_tint);
setBackgroundResource(R.drawable.routing_toolbar_button);
setButtonTintList(R.color.routing_toolbar_icon_tint);
}
public void progress()

View file

@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_activated="true"
android:color="@color/routing_button_activated_tint"/>
android:color="?routingToolbarButtonIconActive"/>
<item
android:state_pressed="true"
android:color="@color/routing_button_pressed_tint"/>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_activated="true"
android:color="@color/routing_button_activated_tint_night"/>
<item
android:state_pressed="true"
android:color="@color/routing_button_pressed_tint"/>
<item
android:color="@color/routing_button_tint"/>
</selector>

View file

@ -3,5 +3,5 @@
android:shape="oval"
android:height="40dp"
android:width="40dp">
<solid android:color="@color/white_primary"/>
<solid android:color="?routingToolbarButtonActive"/>
</shape>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item>
<selector>
<item
android:state_activated="true"
android:drawable="@drawable/routing_toolbar_button_active"/>
<item
android:drawable="@drawable/routing_toolbar_button_normal_night"/>
</selector>
</item>
</ripple>

View file

@ -3,5 +3,5 @@
android:shape="oval"
android:height="40dp"
android:width="40dp">
<solid android:color="@color/bg_primary_dark"/>
<solid android:color="?routingToolbarButton"/>
</shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:height="40dp"
android:width="40dp">
<solid android:color="@color/bg_primary_dark_night"/>
</shape>

View file

@ -81,6 +81,9 @@
<item name="navigationTheme">@style/MwmTheme.Navigation</item>
<item name="routingButtonHint">@color/routing_button_tint</item>
<item name="routingToolbarButtonIconActive">@color/routing_button_activated_tint_night</item>
<item name="routingToolbarButtonActive">@color/routing_button_tint</item>
<item name="routingToolbarButton">@color/bg_primary_dark_night</item>
<item name="android:listDivider">@drawable/list_divider_night</item>

View file

@ -43,6 +43,9 @@
<attr name="downloaderTheme" format="reference" />
<attr name="navigationTheme" format="reference" />
<attr name="routingButtonHint" format="color" />
<attr name="routingToolbarButtonIconActive" format="color" />
<attr name="routingToolbarButtonActive" format="color" />
<attr name="routingToolbarButton" format="color" />
<attr name="drivingOptionsViewBg" format="color" />
<attr name="transitPedestrianBackground" format="color" />
<attr name="transitRulerBackground" format="color" />

View file

@ -79,6 +79,10 @@
<item name="navigationTheme">@style/MwmTheme.Navigation</item>
<item name="routingButtonHint">@color/routing_button_tint</item>
<item name="routingToolbarButtonIconActive">@color/routing_button_activated_tint</item>
<item name="routingToolbarButtonActive">@color/routing_button_tint</item>
<item name="routingToolbarButton">@color/bg_primary_dark</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>