From 8812d6f5e74d0b86d3cf5ef7f349925b70b2ea5f Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Tue, 1 Sep 2015 21:24:45 +0800 Subject: [PATCH] fixed black drawer background in solid background mode --- twidere/build.gradle | 2 +- .../mariotaku/twidere/util/ThemeUtils.java | 29 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/twidere/build.gradle b/twidere/build.gradle index 7d6c9652c..ef9007fa9 100644 --- a/twidere/build.gradle +++ b/twidere/build.gradle @@ -14,7 +14,7 @@ android { applicationId "org.mariotaku.twidere" minSdkVersion 14 targetSdkVersion 23 - versionCode 118 + versionCode 119 versionName "0.3.0" multiDexEnabled true } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java index 5dd57fe0a..b076640d3 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java @@ -80,16 +80,15 @@ import java.lang.reflect.Field; public class ThemeUtils implements Constants { public static final int ACCENT_COLOR_THRESHOLD = 192; - - private static final int[] ANIM_OPEN_STYLE_ATTRS = {android.R.attr.activityOpenEnterAnimation, - android.R.attr.activityOpenExitAnimation}; - private static final int[] ANIM_CLOSE_STYLE_ATTRS = {android.R.attr.activityCloseEnterAnimation, - android.R.attr.activityCloseExitAnimation}; public static final int[] ATTRS_TEXT_COLOR_PRIMARY = {android.R.attr.textColorPrimary}; public static final int[] ATTRS_TEXT_COLOR_PRIMARY_AND_INVERSE = {android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse}; public static final int[] ATTRS_COLOR_FOREGROUND_AND_INVERSE = {android.R.attr.colorForeground, android.R.attr.colorForegroundInverse}; + private static final int[] ANIM_OPEN_STYLE_ATTRS = {android.R.attr.activityOpenEnterAnimation, + android.R.attr.activityOpenExitAnimation}; + private static final int[] ANIM_CLOSE_STYLE_ATTRS = {android.R.attr.activityCloseEnterAnimation, + android.R.attr.activityCloseExitAnimation}; private ThemeUtils() { throw new AssertionError(); @@ -285,7 +284,7 @@ public class ThemeUtils implements Constants { if (!(view instanceof ActionBarOverlayLayout)) { final View contentLayout = window.findViewById(android.support.v7.appcompat.R.id.action_bar_activity_content); if (contentLayout instanceof ContentFrameLayout) { - return ((ContentFrameLayout) contentLayout).getForeground(); + return contentLayout.getForeground(); } return null; } @@ -980,7 +979,7 @@ public class ThemeUtils implements Constants { contentLayout = window.findViewById(android.R.id.content); } if (contentLayout instanceof ContentFrameLayout) { - ((ContentFrameLayout) contentLayout).setForeground(overlay); + contentLayout.setForeground(overlay); } } @@ -1002,7 +1001,7 @@ public class ThemeUtils implements Constants { final int alpha = ((IThemedActivity) context).getCurrentThemeBackgroundAlpha(); final Drawable d; if (isSolidBackground(backgroundOption)) { - d = new ColorDrawable(Color.BLACK); + d = new ColorDrawable(isDarkTheme(themeRes) ? Color.BLACK : Color.WHITE); } else { d = getWindowBackgroundFromTheme(context, drawerThemeRes); } @@ -1148,13 +1147,6 @@ public class ThemeUtils implements Constants { return VALUE_THEME_NAME_DARK.equals(name); } - public static final class ActionBarContextThemeWrapper extends android.support.v7.internal.view.ContextThemeWrapper { - - public ActionBarContextThemeWrapper(Context base, int themeres) { - super(base, themeres); - } - } - public static int getActionBarThemeResource(int themeId, int accentColor) { if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) { return R.style.Theme_Twidere_Dark; @@ -1162,4 +1154,11 @@ public class ThemeUtils implements Constants { return R.style.Theme_Twidere_Light; } } + + public static final class ActionBarContextThemeWrapper extends android.support.v7.internal.view.ContextThemeWrapper { + + public ActionBarContextThemeWrapper(Context base, int themeres) { + super(base, themeres); + } + } }