Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ public class BarTransitions { private static final boolean DEBUG = false; private static final boolean DEBUG = false; private static final boolean DEBUG_COLORS = false; private static final boolean DEBUG_COLORS = false; public static final boolean HIGH_END = ActivityManager.isHighEndGfx(); public static final int MODE_OPAQUE = 0; public static final int MODE_OPAQUE = 0; public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_TRANSLUCENT = 2; public static final int MODE_TRANSLUCENT = 2; Loading @@ -48,7 +50,6 @@ public class BarTransitions { private final String mTag; private final String mTag; private final View mView; private final View mView; private final boolean mSupportsTransitions = ActivityManager.isHighEndGfx(); private final BarBackgroundDrawable mBarBackground; private final BarBackgroundDrawable mBarBackground; private int mMode; private int mMode; Loading @@ -57,7 +58,7 @@ public class BarTransitions { mTag = "BarTransitions." + view.getClass().getSimpleName(); mTag = "BarTransitions." + view.getClass().getSimpleName(); mView = view; mView = view; mBarBackground = new BarBackgroundDrawable(mView.getContext(), gradientResourceId); mBarBackground = new BarBackgroundDrawable(mView.getContext(), gradientResourceId); if (mSupportsTransitions) { if (HIGH_END) { mView.setBackground(mBarBackground); mView.setBackground(mBarBackground); } } } } Loading @@ -67,19 +68,23 @@ public class BarTransitions { } } public void transitionTo(int mode, boolean animate) { public void transitionTo(int mode, boolean animate) { // low-end devices do not support translucent modes, fallback to opaque if (!HIGH_END && (mode == MODE_SEMI_TRANSPARENT || mode == MODE_TRANSLUCENT)) { mode = MODE_OPAQUE; } if (mMode == mode) return; if (mMode == mode) return; int oldMode = mMode; int oldMode = mMode; mMode = mode; mMode = mode; if (DEBUG) Log.d(mTag, String.format("%s -> %s animate=%s", if (DEBUG) Log.d(mTag, String.format("%s -> %s animate=%s", modeToString(oldMode), modeToString(mode), animate)); modeToString(oldMode), modeToString(mode), animate)); if (mSupportsTransitions) { onTransition(oldMode, mMode, animate); onTransition(oldMode, mMode, animate); } } } protected void onTransition(int oldMode, int newMode, boolean animate) { protected void onTransition(int oldMode, int newMode, boolean animate) { if (HIGH_END) { applyModeBackground(oldMode, newMode, animate); applyModeBackground(oldMode, newMode, animate); } } } protected void applyModeBackground(int oldMode, int newMode, boolean animate) { protected void applyModeBackground(int oldMode, int newMode, boolean animate) { if (DEBUG) Log.d(mTag, String.format("applyModeBackground oldMode=%s newMode=%s animate=%s", if (DEBUG) Log.d(mTag, String.format("applyModeBackground oldMode=%s newMode=%s animate=%s", Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ public class BarTransitions { private static final boolean DEBUG = false; private static final boolean DEBUG = false; private static final boolean DEBUG_COLORS = false; private static final boolean DEBUG_COLORS = false; public static final boolean HIGH_END = ActivityManager.isHighEndGfx(); public static final int MODE_OPAQUE = 0; public static final int MODE_OPAQUE = 0; public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_TRANSLUCENT = 2; public static final int MODE_TRANSLUCENT = 2; Loading @@ -48,7 +50,6 @@ public class BarTransitions { private final String mTag; private final String mTag; private final View mView; private final View mView; private final boolean mSupportsTransitions = ActivityManager.isHighEndGfx(); private final BarBackgroundDrawable mBarBackground; private final BarBackgroundDrawable mBarBackground; private int mMode; private int mMode; Loading @@ -57,7 +58,7 @@ public class BarTransitions { mTag = "BarTransitions." + view.getClass().getSimpleName(); mTag = "BarTransitions." + view.getClass().getSimpleName(); mView = view; mView = view; mBarBackground = new BarBackgroundDrawable(mView.getContext(), gradientResourceId); mBarBackground = new BarBackgroundDrawable(mView.getContext(), gradientResourceId); if (mSupportsTransitions) { if (HIGH_END) { mView.setBackground(mBarBackground); mView.setBackground(mBarBackground); } } } } Loading @@ -67,19 +68,23 @@ public class BarTransitions { } } public void transitionTo(int mode, boolean animate) { public void transitionTo(int mode, boolean animate) { // low-end devices do not support translucent modes, fallback to opaque if (!HIGH_END && (mode == MODE_SEMI_TRANSPARENT || mode == MODE_TRANSLUCENT)) { mode = MODE_OPAQUE; } if (mMode == mode) return; if (mMode == mode) return; int oldMode = mMode; int oldMode = mMode; mMode = mode; mMode = mode; if (DEBUG) Log.d(mTag, String.format("%s -> %s animate=%s", if (DEBUG) Log.d(mTag, String.format("%s -> %s animate=%s", modeToString(oldMode), modeToString(mode), animate)); modeToString(oldMode), modeToString(mode), animate)); if (mSupportsTransitions) { onTransition(oldMode, mMode, animate); onTransition(oldMode, mMode, animate); } } } protected void onTransition(int oldMode, int newMode, boolean animate) { protected void onTransition(int oldMode, int newMode, boolean animate) { if (HIGH_END) { applyModeBackground(oldMode, newMode, animate); applyModeBackground(oldMode, newMode, animate); } } } protected void applyModeBackground(int oldMode, int newMode, boolean animate) { protected void applyModeBackground(int oldMode, int newMode, boolean animate) { if (DEBUG) Log.d(mTag, String.format("applyModeBackground oldMode=%s newMode=%s animate=%s", if (DEBUG) Log.d(mTag, String.format("applyModeBackground oldMode=%s newMode=%s animate=%s", Loading