Don't use attr for color value in drawables.

According to the following this is not supported:

 * http://stackoverflow.com/a/13471695/2391921

This uses the approach in that SO answer, by extracting the attribute to
instead point at a drawable, and have one drawable for each theme.

Fixes #979.
This commit is contained in:
Peter Serwylo 2017-04-26 09:27:02 +10:00
parent 96a9681fd1
commit 74795d2f7a
8 changed files with 25 additions and 10 deletions

View File

@ -5,5 +5,5 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" /> <corners android:radius="4dp" />
<solid android:color="?attr/categoryPreviewAppCardBackground" /> <solid android:color="#212121" />
</shape> </shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Visually different from other app cards because it doesn't have a drop shadow, and has a larger
corner radius.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" />
<solid android:color="#faf8ef" />
</shape>

View File

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="3dp" /> <corners android:radius="3dp" />
<solid android:color="?attr/detailPanel" /> <solid android:color="#303030" />
</shape> </shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#eff4f9" />
</shape>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="130dp" android:layout_height="130dp"
android:background="@drawable/category_preview_app_card_background" android:background="?attr/categoryPreviewAppCardBackground"
android:padding="8dp"> android:padding="8dp">
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon" <!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"

View File

@ -7,7 +7,7 @@
android:layout_margin="@dimen/details_activity_padding" android:layout_margin="@dimen/details_activity_padding"
android:clickable="true" android:clickable="true"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/details_panel_light_background" android:background="?attr/detailPanel"
android:padding="@dimen/details_activity_padding"> android:padding="@dimen/details_activity_padding">
<TextView <TextView

View File

@ -3,12 +3,12 @@
<declare-styleable name="Theme"> <declare-styleable name="Theme">
<attr name="appDetailsBackground" format="color" /> <attr name="appDetailsBackground" format="color" />
<attr name="appDetailsCardBackground" format="color" /> <attr name="appDetailsCardBackground" format="color" />
<attr name="categoryPreviewAppCardBackground" format="color" /> <attr name="categoryPreviewAppCardBackground" format="reference" />
<attr name="mainTabSwapBackground" format="color" /> <attr name="mainTabSwapBackground" format="color" />
<attr name="mainTabSwapSplashTint" format="color" /> <attr name="mainTabSwapSplashTint" format="color" />
<attr name="categoryName" format="color" /> <attr name="categoryName" format="color" />
<attr name="installedApps" format="color" /> <attr name="installedApps" format="color" />
<attr name="detailPanel" format="color" /> <attr name="detailPanel" format="reference" />
<attr name="appListItem" format="color" /> <attr name="appListItem" format="color" />
</declare-styleable> </declare-styleable>
</resources> </resources>

View File

@ -14,12 +14,12 @@
<item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item> <item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item>
<item name="appDetailsBackground">#0c0c0c</item> <item name="appDetailsBackground">#0c0c0c</item>
<item name="appDetailsCardBackground">#000000</item> <item name="appDetailsCardBackground">#000000</item>
<item name="categoryPreviewAppCardBackground">#303030</item> <item name="categoryPreviewAppCardBackground">@drawable/category_preview_app_card_background_dark</item>
<item name="mainTabSwapBackground">#0a0a0a</item> <item name="mainTabSwapBackground">#0a0a0a</item>
<item name="mainTabSwapSplashTint">#050505</item> <item name="mainTabSwapSplashTint">#050505</item>
<item name="categoryName">#ffffff</item> <item name="categoryName">#ffffff</item>
<item name="installedApps">#ffffff</item> <item name="installedApps">#ffffff</item>
<item name="detailPanel">#212121</item> <item name="detailPanel">@drawable/details_panel_donate_background_dark</item>
<item name="appListItem">#ffffff</item> <item name="appListItem">#ffffff</item>
</style> </style>
@ -36,12 +36,12 @@
<item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item> <item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item>
<item name="appDetailsBackground">#fcfcfc</item> <item name="appDetailsBackground">#fcfcfc</item>
<item name="appDetailsCardBackground">#ffffff</item> <item name="appDetailsCardBackground">#ffffff</item>
<item name="categoryPreviewAppCardBackground">#faf8ef</item> <item name="categoryPreviewAppCardBackground">@drawable/category_preview_app_card_background_light</item>
<item name="mainTabSwapBackground">#fafafa</item> <item name="mainTabSwapBackground">#fafafa</item>
<item name="mainTabSwapSplashTint">#f5f5f5</item> <item name="mainTabSwapSplashTint">#f5f5f5</item>
<item name="categoryName">#4a4a4a</item> <item name="categoryName">#4a4a4a</item>
<item name="installedApps">#424242</item> <item name="installedApps">#424242</item>
<item name="detailPanel">#eff4f9</item> <item name="detailPanel">@drawable/details_panel_donate_background_light</item>
<item name="appListItem">#424242</item> <item name="appListItem">#424242</item>
</style> </style>