From 20b1e4ea96cbc61b3a2cc9d948bf21fe41f7b725 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 5 Jan 2016 17:46:13 -0800 Subject: Update CardView to use themed version of card_rounded_corners (pre-L does not support attr colors) --- app/src/main/java/github/daneren2005/dsub/view/CardView.java | 3 ++- app/src/main/res/drawable/card_rounded_corners.xml | 6 ------ app/src/main/res/drawable/card_rounded_corners_black.xml | 6 ++++++ app/src/main/res/drawable/card_rounded_corners_dark.xml | 6 ++++++ app/src/main/res/drawable/card_rounded_corners_light.xml | 6 ++++++ app/src/main/res/values/attrs.xml | 2 +- app/src/main/res/values/themes.xml | 10 +++++----- 7 files changed, 26 insertions(+), 13 deletions(-) delete mode 100644 app/src/main/res/drawable/card_rounded_corners.xml create mode 100644 app/src/main/res/drawable/card_rounded_corners_black.xml create mode 100644 app/src/main/res/drawable/card_rounded_corners_dark.xml create mode 100644 app/src/main/res/drawable/card_rounded_corners_light.xml (limited to 'app') 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.xml b/app/src/main/res/drawable/card_rounded_corners.xml deleted file mode 100644 index 87e84c0d..00000000 --- a/app/src/main/res/drawable/card_rounded_corners.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file 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 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/card_rounded_corners_dark.xml b/app/src/main/res/drawable/card_rounded_corners_dark.xml new file mode 100644 index 00000000..4db7d4b0 --- /dev/null +++ b/app/src/main/res/drawable/card_rounded_corners_dark.xml @@ -0,0 +1,6 @@ + + + + + + \ 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 @@ + + + + + + \ 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 @@ - + 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 @@ @style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse true ?attr/colorPrimary - @android:color/white + @drawable/card_rounded_corners_light - -