From 533d8ed0aef2cb5c17fd0b232f67f4454bbed8e5 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sun, 19 Jul 2015 23:10:08 +0800 Subject: [PATCH] removed unused code --- .../mariotaku/twidere/util/ThemeUtils.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) 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 dae04f82a..4b8fd3b68 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/ThemeUtils.java @@ -590,8 +590,6 @@ public class ThemeUtils implements Constants { if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) { // windowBackground is a color return value.data; - } else if (value.type == TypedValue.TYPE_REFERENCE) { - return theme.getResources().getColor(value.resourceId); } return 0; } @@ -736,22 +734,13 @@ public class ThemeUtils implements Constants { final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowBackground}, 0, theme); final Drawable d = a.getDrawable(0); a.recycle(); - if (d != null) { - d.setAlpha(MathUtils.clamp(alpha, ThemeBackgroundPreference.MIN_ALPHA, - ThemeBackgroundPreference.MAX_ALPHA)); - } + if (d == null) return null; + d.mutate(); + d.setAlpha(MathUtils.clamp(alpha, ThemeBackgroundPreference.MIN_ALPHA, + ThemeBackgroundPreference.MAX_ALPHA)); return d; } - public static Drawable getWindowContentOverlay(final Context context) { - final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowContentOverlay}); - try { - return a.getDrawable(0); - } finally { - a.recycle(); - } - } - public static Drawable getWindowContentOverlay(final Context context, int themeRes) { @SuppressWarnings("ConstantConditions") final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowContentOverlay}, 0, themeRes); @@ -1017,6 +1006,7 @@ public class ThemeUtils implements Constants { d = getWindowBackgroundFromTheme(context, drawerThemeRes); } if (d == null) throw new NullPointerException(); + d.mutate(); if (isTransparentBackground(backgroundOption)) { d.setAlpha(alpha); }