Do not override the android:* text colors, define our own. This fixes a crash on API 19.

Also define them in the attrs xml file and do some grouping in the colors xml.
It might be we don't need them at all, but for the time being let's keep them around.
master
Daniele Gobbetti 2017-04-08 15:49:00 +02:00
parent bd833a37d4
commit 2e98b1396f
5 changed files with 18 additions and 9 deletions

View File

@ -433,7 +433,7 @@ public class GBApplication extends Application {
public static int getTextColor(Context context) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = context.getTheme();
theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
theme.resolveAttribute(R.attr.textColorPrimary, typedValue, true);
return typedValue.data;
}

View File

@ -48,7 +48,7 @@
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:contentDescription="@string/controlcenter_delete_device"
android:tint="?android:textColorTertiary"
android:tint="?attr/textColorTertiary"
card_view:srcCompat="@drawable/ic_remove_device" />
</RelativeLayout>
@ -62,7 +62,7 @@
android:clickable="true"
android:longClickable="true"
android:background="?android:attr/selectableItemBackground"
tools:src="@drawable/ic_device_pebble"
android:src="@drawable/ic_device_pebble"
android:layout_marginTop="8dp" />
<TextView

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="textColorPrimary" format="color" />
<attr name="textColorSecondary" format="color" />
<attr name="textColorTertiary" format="color" />
<attr name="chart_deep_sleep" format="color" />
<attr name="chart_light_sleep" format="color" />
<attr name="chart_activity" format="color" />

View File

@ -7,11 +7,14 @@
<color name="primarydark_dark" type="color">#f0f03000</color>
<color name="accent" type="color">#0091ea</color>
<color name="primarytext_light" type="color">#000000</color>
<color name="primarytext_dark" type="color">#ffffff</color>
<color name="secondarytext" type="color">#ff808080</color>
<color name="tertiarytext_light" type="color">#ffd0d0d0</color>
<color name="tertiarytext_dark" type="color">#ff606060</color>
<color name="divider" type="color">#1f000000</color>
<color name="chart_heartrate" type="color">#ffab40</color>

View File

@ -1,11 +1,12 @@
<resources>
<style name="GadgetbridgeTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColorPrimary">@color/primarytext_light</item>
<item name="android:textColorSecondary">@color/secondarytext</item>
<item name="textColorPrimary">@color/primarytext_light</item>
<item name="textColorSecondary">@color/secondarytext</item>
<item name="textColorTertiary">@color/tertiarytext_light</item>
<item name="colorPrimary">@color/primary_light</item>
<item name="colorPrimaryDark">@color/primarydark_light</item>
<item name="android:textColorTertiary">@color/tertiarytext_light</item>
<item name="colorAccent">@color/accent</item>
<item name="chart_deep_sleep">@color/chart_deep_sleep_light</item>
@ -21,11 +22,12 @@
<!-- dark theme -->
<style name="GadgetbridgeThemeDark" parent="Theme.AppCompat">
<item name="android:textColorPrimary">@color/primarytext_dark</item>
<item name="android:textColorSecondary">@color/secondarytext</item>
<item name="textColorPrimary">@color/primarytext_dark</item>
<item name="textColorSecondary">@color/secondarytext</item>
<item name="textColorTertiary">@color/tertiarytext_dark</item>
<item name="colorPrimary">@color/primary_dark</item>
<item name="colorPrimaryDark">@color/primarydark_dark</item>
<item name="android:textColorTertiary">@color/tertiarytext_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="chart_deep_sleep">@color/chart_deep_sleep_dark</item>