BarTransitionspublic class BarTransitions extends Object
Fields Summary |
---|
private static final boolean | DEBUG | private static final boolean | DEBUG_COLORS | public static final boolean | HIGH_END | public static final int | MODE_OPAQUE | public static final int | MODE_SEMI_TRANSPARENT | public static final int | MODE_TRANSLUCENT | public static final int | MODE_LIGHTS_OUT | public static final int | MODE_TRANSPARENT | public static final int | MODE_WARNING | public static final int | MODE_LIGHTS_OUT_TRANSPARENT | public static final int | LIGHTS_IN_DURATION | public static final int | LIGHTS_OUT_DURATION | public static final int | BACKGROUND_DURATION | private final String | mTag | private final android.view.View | mView | private final BarBackgroundDrawable | mBarBackground | private int | mMode |
Constructors Summary |
---|
public BarTransitions(android.view.View view, int gradientResourceId)
mTag = "BarTransitions." + view.getClass().getSimpleName();
mView = view;
mBarBackground = new BarBackgroundDrawable(mView.getContext(), gradientResourceId);
if (HIGH_END) {
mView.setBackground(mBarBackground);
}
|
Methods Summary |
---|
protected void | applyModeBackground(int oldMode, int newMode, boolean animate)
if (DEBUG) Log.d(mTag, String.format("applyModeBackground oldMode=%s newMode=%s animate=%s",
modeToString(oldMode), modeToString(newMode), animate));
mBarBackground.applyModeBackground(oldMode, newMode, animate);
| public void | finishAnimations()
mBarBackground.finishAnimation();
| public int | getMode()
return mMode;
| protected boolean | isLightsOut(int mode)
return mode == MODE_LIGHTS_OUT || mode == MODE_LIGHTS_OUT_TRANSPARENT;
| public static java.lang.String | modeToString(int mode)
if (mode == MODE_OPAQUE) return "MODE_OPAQUE";
if (mode == MODE_SEMI_TRANSPARENT) return "MODE_SEMI_TRANSPARENT";
if (mode == MODE_TRANSLUCENT) return "MODE_TRANSLUCENT";
if (mode == MODE_LIGHTS_OUT) return "MODE_LIGHTS_OUT";
if (mode == MODE_TRANSPARENT) return "MODE_TRANSPARENT";
if (mode == MODE_WARNING) return "MODE_WARNING";
if (mode == MODE_LIGHTS_OUT_TRANSPARENT) return "MODE_LIGHTS_OUT_TRANSPARENT";
throw new IllegalArgumentException("Unknown mode " + mode);
| protected void | onTransition(int oldMode, int newMode, boolean animate)
if (HIGH_END) {
applyModeBackground(oldMode, newMode, 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_TRANSPARENT)) {
mode = MODE_OPAQUE;
}
if (!HIGH_END && (mode == MODE_LIGHTS_OUT_TRANSPARENT)) {
mode = MODE_LIGHTS_OUT;
}
if (mMode == mode) return;
int oldMode = mMode;
mMode = mode;
if (DEBUG) Log.d(mTag, String.format("%s -> %s animate=%s",
modeToString(oldMode), modeToString(mode), animate));
onTransition(oldMode, mMode, animate);
|
|