aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-01-05 17:46:13 -0800
committerScott Jackson <daneren2005@gmail.com>2016-01-05 17:46:13 -0800
commit20b1e4ea96cbc61b3a2cc9d948bf21fe41f7b725 (patch)
tree7e436debe53429e3ac85e1d01cdbc86aa29b09b2 /app
parent2ff02bf125d1f85517fde35d3a8bd927b87f1771 (diff)
downloaddsub-20b1e4ea96cbc61b3a2cc9d948bf21fe41f7b725.tar.gz
dsub-20b1e4ea96cbc61b3a2cc9d948bf21fe41f7b725.tar.bz2
dsub-20b1e4ea96cbc61b3a2cc9d948bf21fe41f7b725.zip
Update CardView to use themed version of card_rounded_corners (pre-L does not support attr colors)
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/CardView.java3
-rw-r--r--app/src/main/res/drawable/card_rounded_corners_black.xml6
-rw-r--r--app/src/main/res/drawable/card_rounded_corners_dark.xml (renamed from app/src/main/res/drawable/card_rounded_corners.xml)2
-rw-r--r--app/src/main/res/drawable/card_rounded_corners_light.xml6
-rw-r--r--app/src/main/res/values/attrs.xml2
-rw-r--r--app/src/main/res/values/themes.xml10
6 files changed, 21 insertions, 8 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/view/CardView.java b/app/src/main/java/github/daneren2005/dsub/view/CardView.java
index 7a38b13b..576aa52d 100644
--- a/app/src/main/java/github/daneren2005/dsub/view/CardView.java
+++ b/app/src/main/java/github/daneren2005/dsub/view/CardView.java
@@ -11,6 +11,7 @@ import android.util.Log;
import android.widget.FrameLayout;
import github.daneren2005.dsub.R;
+import github.daneren2005.dsub.util.DrawableTint;
public class CardView extends FrameLayout{
public CardView(Context context) {
@@ -46,7 +47,7 @@ public class CardView extends FrameLayout{
private void init(Context context) {
setClipChildren(true);
- setBackgroundResource(R.drawable.card_rounded_corners);
+ setBackgroundResource(DrawableTint.getDrawableRes(context, R.attr.cardBackgroundDrawable));
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setElevation(getResources().getInteger(R.integer.Card_Elevation));
}
diff --git a/app/src/main/res/drawable/card_rounded_corners_black.xml b/app/src/main/res/drawable/card_rounded_corners_black.xml
new file mode 100644
index 00000000..7592de64
--- /dev/null
+++ b/app/src/main/res/drawable/card_rounded_corners_black.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/background_material_dark"/>
+ <corners android:radius="@dimen/Card.Radius"/>
+ <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
+</shape> \ No newline at end of file
diff --git a/app/src/main/res/drawable/card_rounded_corners.xml b/app/src/main/res/drawable/card_rounded_corners_dark.xml
index 87e84c0d..4db7d4b0 100644
--- a/app/src/main/res/drawable/card_rounded_corners.xml
+++ b/app/src/main/res/drawable/card_rounded_corners_dark.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="?attr/cardBackgroundColor"/>
+ <solid android:color="@android:color/black"/>
<corners android:radius="@dimen/Card.Radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape> \ No newline at end of file
diff --git a/app/src/main/res/drawable/card_rounded_corners_light.xml b/app/src/main/res/drawable/card_rounded_corners_light.xml
new file mode 100644
index 00000000..5475c3d6
--- /dev/null
+++ b/app/src/main/res/drawable/card_rounded_corners_light.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/white"/>
+ <corners android:radius="@dimen/Card.Radius"/>
+ <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
+</shape> \ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index e4fa4b5a..4206d9f0 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -55,7 +55,7 @@
<attr name="actionbarBackgroundColor" format="reference"/>
<attr name="drawerTitleStyle" format="reference"/>
<attr name="drawerSubtitleStyle" format="reference"/>
- <attr name="cardBackgroundColor" format="reference"/>
+ <attr name="cardBackgroundDrawable" format="reference"/>
<declare-styleable name="SeekBarPreference">
<attr name="min" format="integer"/>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 8c6b1a59..c125c18a 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -62,7 +62,7 @@
<item name="drawerSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?attr/colorPrimary</item>
- <item name="cardBackgroundColor">@android:color/white</item>
+ <item name="cardBackgroundDrawable">@drawable/card_rounded_corners_light</item>
</style>
<style name="Theme.DSub.Dark.Base" parent="@style/Theme.AppCompat">
<item name="offline_icon">@drawable/main_offline_dark</item>
@@ -125,17 +125,17 @@
<item name="drawerSubtitleStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?attr/colorPrimary</item>
- <item name="cardBackgroundColor">@color/background_material_dark</item>
+ <item name="cardBackgroundDrawable">@drawable/card_rounded_corners_black</item>
</style>
<style name="Theme.DSub.Light" parent="Theme.DSub.Light.Base">
</style>
<style name="Theme.DSub.Dark" parent="Theme.DSub.Dark.Base">
- <item name="cardBackgroundColor">@android:color/black</item>
+ <item name="cardBackgroundDrawable">@drawable/card_rounded_corners_dark</item>
</style>
- <style name="Theme.DSub.Black" parent="Theme.DSub.Dark">
+ <style name="Theme.DSub.Black" parent="Theme.DSub.Dark.Base">
<item name="android:windowBackground">@android:color/black</item>
</style>
- <style name="Theme.DSub.Holo" parent="Theme.DSub.Dark">
+ <style name="Theme.DSub.Holo" parent="Theme.DSub.Dark.Base">
<item name="android:windowBackground">@drawable/background</item>
<item name="colorPrimary">@color/holoPrimary</item>
<item name="colorPrimaryDark">@color/holoPrimaryDark</item>