Fields Summary |
---|
public static final long | ANIMATION_DURATION |
private static final float | SCRIM_BEHIND_ALPHA |
private static final float | SCRIM_BEHIND_ALPHA_KEYGUARD |
private static final float | SCRIM_BEHIND_ALPHA_UNLOCKING |
private static final float | SCRIM_IN_FRONT_ALPHA |
private static final int | TAG_KEY_ANIM |
private final com.android.systemui.statusbar.ScrimView | mScrimBehind |
private final com.android.systemui.statusbar.ScrimView | mScrimInFront |
private final UnlockMethodCache | mUnlockMethodCache |
private boolean | mKeyguardShowing |
private float | mFraction |
private boolean | mDarkenWhileDragging |
private boolean | mBouncerShowing |
private boolean | mAnimateChange |
private boolean | mUpdatePending |
private boolean | mExpanding |
private boolean | mAnimateKeyguardFadingOut |
private long | mDurationOverride |
private long | mAnimationDelay |
private Runnable | mOnAnimationFinished |
private boolean | mAnimationStarted |
private final android.view.animation.Interpolator | mInterpolator |
private final android.view.animation.Interpolator | mLinearOutSlowInInterpolator |
private com.android.systemui.statusbar.BackDropView | mBackDropView |
private boolean | mScrimSrcEnabled |
private boolean | mDozing |
private float | mDozeInFrontAlpha |
private float | mDozeBehindAlpha |
private float | mCurrentInFrontAlpha |
private float | mCurrentBehindAlpha |
Methods Summary |
---|
public void | animateGoingToFullShade(long delay, long duration)
mDurationOverride = duration;
mAnimationDelay = delay;
mAnimateChange = true;
scheduleUpdate();
|
public void | animateKeyguardFadingOut(long delay, long duration, java.lang.Runnable onAnimationFinished)
mAnimateKeyguardFadingOut = true;
mDurationOverride = duration;
mAnimationDelay = delay;
mAnimateChange = true;
mOnAnimationFinished = onAnimationFinished;
scheduleUpdate();
|
private float | getCurrentScrimAlpha(android.view.View scrim)
return scrim == mScrimBehind ? mCurrentBehindAlpha : mCurrentInFrontAlpha;
|
private float | getDozeAlpha(android.view.View scrim)
return scrim == mScrimBehind ? mDozeBehindAlpha : mDozeInFrontAlpha;
|
public float | getDozeBehindAlpha()
return mDozeBehindAlpha;
|
public float | getDozeInFrontAlpha()
return mDozeInFrontAlpha;
|
private android.view.animation.Interpolator | getInterpolator()
return mAnimateKeyguardFadingOut ? mLinearOutSlowInInterpolator : mInterpolator;
|
public void | onExpandingFinished()
mExpanding = false;
|
public boolean | onPreDraw()
mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
mUpdatePending = false;
updateScrims();
mAnimateKeyguardFadingOut = false;
mDurationOverride = -1;
mAnimationDelay = 0;
// Make sure that we always call the listener even if we didn't start an animation.
if (!mAnimationStarted && mOnAnimationFinished != null) {
mOnAnimationFinished.run();
mOnAnimationFinished = null;
}
mAnimationStarted = false;
return true;
|
public void | onTrackingStarted()
mExpanding = true;
mDarkenWhileDragging = !mUnlockMethodCache.isCurrentlyInsecure();
|
private void | scheduleUpdate()
if (mUpdatePending) return;
// Make sure that a frame gets scheduled.
mScrimBehind.invalidate();
mScrimBehind.getViewTreeObserver().addOnPreDrawListener(this);
mUpdatePending = true;
|
public void | setBackDropView(com.android.systemui.statusbar.BackDropView backDropView)
mBackDropView = backDropView;
mBackDropView.setOnVisibilityChangedRunnable(new Runnable() {
@Override
public void run() {
updateScrimBehindDrawingMode();
}
});
updateScrimBehindDrawingMode();
|
public void | setBouncerShowing(boolean showing)
mBouncerShowing = showing;
mAnimateChange = !mExpanding;
scheduleUpdate();
|
private void | setCurrentScrimAlpha(android.view.View scrim, float alpha)
if (scrim == mScrimBehind) {
mCurrentBehindAlpha = alpha;
} else {
mCurrentInFrontAlpha = alpha;
}
|
public void | setDozeBehindAlpha(float alpha)
mDozeBehindAlpha = alpha;
updateScrimColor(mScrimBehind);
|
public void | setDozeInFrontAlpha(float alpha)
mDozeInFrontAlpha = alpha;
updateScrimColor(mScrimInFront);
|
public void | setDozing(boolean dozing)
mDozing = dozing;
scheduleUpdate();
|
public void | setKeyguardShowing(boolean showing)
mKeyguardShowing = showing;
scheduleUpdate();
|
public void | setPanelExpansion(float fraction)
if (mFraction != fraction) {
mFraction = fraction;
scheduleUpdate();
}
|
private void | setScrimBehindColor(float alpha)
setScrimColor(mScrimBehind, alpha);
|
private void | setScrimColor(com.android.systemui.statusbar.ScrimView scrim, float alpha)
Object runningAnim = scrim.getTag(TAG_KEY_ANIM);
if (runningAnim instanceof ValueAnimator) {
((ValueAnimator) runningAnim).cancel();
scrim.setTag(TAG_KEY_ANIM, null);
}
if (mAnimateChange) {
startScrimAnimation(scrim, alpha);
} else {
setCurrentScrimAlpha(scrim, alpha);
updateScrimColor(scrim);
}
|
private void | setScrimInFrontColor(float alpha)
setScrimColor(mScrimInFront, alpha);
if (alpha == 0f) {
mScrimInFront.setClickable(false);
} else {
// Eat touch events (unless dozing).
mScrimInFront.setClickable(!mDozing);
}
|
private void | startScrimAnimation(com.android.systemui.statusbar.ScrimView scrim, float target)
float current = getCurrentScrimAlpha(scrim);
ValueAnimator anim = ValueAnimator.ofFloat(current, target);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (float) animation.getAnimatedValue();
setCurrentScrimAlpha(scrim, alpha);
updateScrimColor(scrim);
}
});
anim.setInterpolator(getInterpolator());
anim.setStartDelay(mAnimationDelay);
anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (mOnAnimationFinished != null) {
mOnAnimationFinished.run();
mOnAnimationFinished = null;
}
scrim.setTag(TAG_KEY_ANIM, null);
}
});
anim.start();
scrim.setTag(TAG_KEY_ANIM, anim);
mAnimationStarted = true;
|
private void | updateScrimBehindDrawingMode()
boolean asSrc = mBackDropView.getVisibility() != View.VISIBLE && mScrimSrcEnabled;
mScrimBehind.setDrawAsSrc(asSrc);
|
private void | updateScrimColor(com.android.systemui.statusbar.ScrimView scrim)
float alpha1 = getCurrentScrimAlpha(scrim);
float alpha2 = getDozeAlpha(scrim);
float alpha = 1 - (1 - alpha1) * (1 - alpha2);
scrim.setScrimColor(Color.argb((int) (alpha * 255), 0, 0, 0));
|
private void | updateScrimKeyguard()
if (mExpanding && mDarkenWhileDragging) {
float behindFraction = Math.max(0, Math.min(mFraction, 1));
float fraction = 1 - behindFraction;
fraction = (float) Math.pow(fraction, 0.8f);
behindFraction = (float) Math.pow(behindFraction, 0.8f);
setScrimInFrontColor(fraction * SCRIM_IN_FRONT_ALPHA);
setScrimBehindColor(behindFraction * SCRIM_BEHIND_ALPHA_KEYGUARD);
} else if (mBouncerShowing) {
setScrimInFrontColor(SCRIM_IN_FRONT_ALPHA);
setScrimBehindColor(0f);
} else {
float fraction = Math.max(0, Math.min(mFraction, 1));
setScrimInFrontColor(0f);
setScrimBehindColor(fraction
* (SCRIM_BEHIND_ALPHA_KEYGUARD - SCRIM_BEHIND_ALPHA_UNLOCKING)
+ SCRIM_BEHIND_ALPHA_UNLOCKING);
}
|
private void | updateScrimNormal()
float frac = mFraction;
// let's start this 20% of the way down the screen
frac = frac * 1.2f - 0.2f;
if (frac <= 0) {
setScrimBehindColor(0);
} else {
// woo, special effects
final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2f))));
setScrimBehindColor(k * SCRIM_BEHIND_ALPHA);
}
|
private void | updateScrims()
if (mAnimateKeyguardFadingOut) {
setScrimInFrontColor(0f);
setScrimBehindColor(0f);
} else if (!mKeyguardShowing && !mBouncerShowing) {
updateScrimNormal();
setScrimInFrontColor(0);
} else {
updateScrimKeyguard();
}
mAnimateChange = false;
|