fixed black drawer background in solid background mode
This commit is contained in:
parent
7f433ed285
commit
8812d6f5e7
|
@ -14,7 +14,7 @@ android {
|
||||||
applicationId "org.mariotaku.twidere"
|
applicationId "org.mariotaku.twidere"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 118
|
versionCode 119
|
||||||
versionName "0.3.0"
|
versionName "0.3.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,16 +80,15 @@ import java.lang.reflect.Field;
|
||||||
public class ThemeUtils implements Constants {
|
public class ThemeUtils implements Constants {
|
||||||
|
|
||||||
public static final int ACCENT_COLOR_THRESHOLD = 192;
|
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 = {android.R.attr.textColorPrimary};
|
||||||
public static final int[] ATTRS_TEXT_COLOR_PRIMARY_AND_INVERSE = {android.R.attr.textColorPrimary,
|
public static final int[] ATTRS_TEXT_COLOR_PRIMARY_AND_INVERSE = {android.R.attr.textColorPrimary,
|
||||||
android.R.attr.textColorPrimaryInverse};
|
android.R.attr.textColorPrimaryInverse};
|
||||||
public static final int[] ATTRS_COLOR_FOREGROUND_AND_INVERSE = {android.R.attr.colorForeground,
|
public static final int[] ATTRS_COLOR_FOREGROUND_AND_INVERSE = {android.R.attr.colorForeground,
|
||||||
android.R.attr.colorForegroundInverse};
|
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() {
|
private ThemeUtils() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -285,7 +284,7 @@ public class ThemeUtils implements Constants {
|
||||||
if (!(view instanceof ActionBarOverlayLayout)) {
|
if (!(view instanceof ActionBarOverlayLayout)) {
|
||||||
final View contentLayout = window.findViewById(android.support.v7.appcompat.R.id.action_bar_activity_content);
|
final View contentLayout = window.findViewById(android.support.v7.appcompat.R.id.action_bar_activity_content);
|
||||||
if (contentLayout instanceof ContentFrameLayout) {
|
if (contentLayout instanceof ContentFrameLayout) {
|
||||||
return ((ContentFrameLayout) contentLayout).getForeground();
|
return contentLayout.getForeground();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -980,7 +979,7 @@ public class ThemeUtils implements Constants {
|
||||||
contentLayout = window.findViewById(android.R.id.content);
|
contentLayout = window.findViewById(android.R.id.content);
|
||||||
}
|
}
|
||||||
if (contentLayout instanceof ContentFrameLayout) {
|
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 int alpha = ((IThemedActivity) context).getCurrentThemeBackgroundAlpha();
|
||||||
final Drawable d;
|
final Drawable d;
|
||||||
if (isSolidBackground(backgroundOption)) {
|
if (isSolidBackground(backgroundOption)) {
|
||||||
d = new ColorDrawable(Color.BLACK);
|
d = new ColorDrawable(isDarkTheme(themeRes) ? Color.BLACK : Color.WHITE);
|
||||||
} else {
|
} else {
|
||||||
d = getWindowBackgroundFromTheme(context, drawerThemeRes);
|
d = getWindowBackgroundFromTheme(context, drawerThemeRes);
|
||||||
}
|
}
|
||||||
|
@ -1148,13 +1147,6 @@ public class ThemeUtils implements Constants {
|
||||||
return VALUE_THEME_NAME_DARK.equals(name);
|
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) {
|
public static int getActionBarThemeResource(int themeId, int accentColor) {
|
||||||
if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
|
if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
|
||||||
return R.style.Theme_Twidere_Dark;
|
return R.style.Theme_Twidere_Dark;
|
||||||
|
@ -1162,4 +1154,11 @@ public class ThemeUtils implements Constants {
|
||||||
return R.style.Theme_Twidere_Light;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue