summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java216
1 files changed, 211 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index e5711b8..3a2c84c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -49,6 +49,9 @@ public abstract class PanelView extends FrameLayout {
public static final boolean DEBUG = PanelBar.DEBUG;
public static final String TAG = PanelView.class.getSimpleName();
+ private static final long ANIMATION_FADE_DURATION = 1000L;
+ private static final long HINT_DELAY_DURATION = 1500L;
+
private final void logf(String fmt, Object... args) {
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
}
@@ -94,7 +97,7 @@ public abstract class PanelView extends FrameLayout {
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
// update expand height
- if (mHeightAnimator != null && mExpanding && mUpdateExpandOnLayout) {
+ if (mHeightAnimator != null && mExpanding && mUpdateExpandOnLayout && !mJustPeeked) {
final int maxPanelHeight = getMaxPanelHeight();
final PropertyValuesHolder[] values = mHeightAnimator.getValues();
values[0].setFloatValues(maxPanelHeight);
@@ -121,6 +124,9 @@ public abstract class PanelView extends FrameLayout {
private boolean mPeekPending;
private boolean mCollapseAfterPeek;
+ private boolean mShowExpandHint;
+ private boolean mShowUnlockHint;
+ private boolean mScreenOnHintAnimationRunning;
/**
* Speed-up factor to be used when {@link #mFlingCollapseRunnable} runs the next time.
@@ -674,7 +680,7 @@ public abstract class PanelView extends FrameLayout {
}
mUpdateExpandOnLayout = isFullyCollapsed();
mFlingAnimationUtils.apply(animator, mExpandedHeight, target, vel, getHeight());
- if (expandBecauseOfFalsing) {
+ if (expandBecauseOfFalsing && vel == 0) {
animator.setDuration(350);
}
} else {
@@ -928,6 +934,7 @@ public abstract class PanelView extends FrameLayout {
private void abortAnimations() {
cancelPeek();
cancelHeightAnimator();
+ mKeyguardBottomArea.getIndicationView().animate().cancel();
removeCallbacks(mPostCollapseRunnable);
removeCallbacks(mFlingCollapseRunnable);
}
@@ -946,6 +953,8 @@ public abstract class PanelView extends FrameLayout {
}
cancelPeek();
notifyExpandingStarted();
+ mKeyguardBottomArea.getIndicationView().animate().cancel();
+ mStatusBar.onUnlockHintStarted();
startUnlockHintAnimationPhase1(new Runnable() {
@Override
public void run() {
@@ -954,8 +963,8 @@ public abstract class PanelView extends FrameLayout {
mHintAnimationRunning = false;
}
});
- mStatusBar.onUnlockHintStarted();
mHintAnimationRunning = true;
+ mShowExpandHint = false;
}
/**
@@ -989,6 +998,7 @@ public abstract class PanelView extends FrameLayout {
mKeyguardBottomArea.getIndicationView().animate()
.translationY(-mHintDistance)
.setDuration(250)
+ .setStartDelay(0)
.setInterpolator(mFastOutSlowInInterpolator)
.withEndAction(new Runnable() {
@Override
@@ -1011,17 +1021,213 @@ public abstract class PanelView extends FrameLayout {
animator.setDuration(450);
animator.setInterpolator(mBounceInterpolator);
animator.addListener(new AnimatorListenerAdapter() {
+ private boolean mCancelled;
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mCancelled = true;
+ }
+
@Override
public void onAnimationEnd(Animator animation) {
mHeightAnimator = null;
- onAnimationFinished.run();
- notifyBarPanelExpansionChanged();
+ if (mCancelled) {
+ onAnimationFinished.run();
+ } else {
+ if (mShowExpandHint) {
+ startUnlockHintFadeOutAnimationPhase(onAnimationFinished);
+ } else {
+ onAnimationFinished.run();
+ notifyBarPanelExpansionChanged();
+ }
+ }
}
});
animator.start();
mHeightAnimator = animator;
}
+ /**
+ * Fade in unlock hint
+ */
+ private void startUnlockHintFadeInAnimationPhase(final Runnable onAnimationFinished) {
+ mStatusBar.onUnlockHintStarted();
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(1)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setStartDelay(0)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ if (mShowExpandHint) {
+ startUnlockHintFadeOutAnimationPhase(onAnimationFinished);
+ } else {
+ onAnimationFinished.run();
+ notifyBarPanelExpansionChanged();
+ }
+ }
+ })
+ .start();
+ }
+
+ /**
+ * Fade out unlock hint
+ */
+ private void startUnlockHintFadeOutAnimationPhase(final Runnable onAnimationFinished) {
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(0)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setStartDelay(HINT_DELAY_DURATION)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ startExpandHintAnimation(onAnimationFinished);
+ }
+ })
+ .start();
+ }
+
+ /**
+ * Fade in Lls hint
+ */
+ private void startLlsHintFadeInAnimationPhase(final Runnable onAnimationFinished) {
+ mKeyguardBottomArea.getIndicationView().setAlpha(0);
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(1)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setStartDelay(0)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ if (mShowUnlockHint || mShowExpandHint) {
+ startLlsHintFadeOutAnimationPhase(onAnimationFinished);
+ } else {
+ onAnimationFinished.run();;
+ }
+ }
+ })
+ .start();
+ }
+
+ /**
+ * Fade out Lls hint
+ */
+ private void startLlsHintFadeOutAnimationPhase(final Runnable onAnimationFinished) {
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(0)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setStartDelay(HINT_DELAY_DURATION)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ if (mShowUnlockHint) {
+ startUnlockHintFadeInAnimationPhase(onAnimationFinished);
+ } else if (mShowExpandHint) {
+ startExpandHintAnimation(onAnimationFinished);
+ } else {
+ onAnimationFinished.run();
+ }
+ }
+ })
+ .start();
+ }
+
+ /**
+ * Fade in expand hint
+ */
+ private void startExpandHintAnimation(final Runnable onAnimationFinished) {
+ mStatusBar.onExpandHintStarted();
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(1)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setStartDelay(0)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ onAnimationFinished.run();
+ }
+ })
+ .start();
+ }
+
+ /**
+ * Show notifications hint (swipe right hint)
+ */
+ protected void startShowNotificationsHintAnimation() {
+ cancelPeek();
+ mStatusBar.onNotificationsHintStarted();
+ mHintAnimationRunning = true;
+ mKeyguardBottomArea.getIndicationView().setAlpha(0);
+ mKeyguardBottomArea.getIndicationView().animate()
+ .alpha(1)
+ .setDuration(ANIMATION_FADE_DURATION)
+ .setInterpolator(null)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mStatusBar.onHintFinished();
+ mHintAnimationRunning = false;
+ }
+ })
+ .start();
+ }
+
+ protected void startScreenOnHintAnimation(boolean showSwipeLeftHint, boolean showUnlockHint,
+ boolean showExpandHint) {
+ // We don't need to hint the user if an animation is already running or the user is changing
+ // the expansion.
+ if (mHintAnimationRunning || mScreenOnHintAnimationRunning) return;
+
+ final View indicationView = mKeyguardBottomArea.getIndicationView();
+ indicationView.animate().cancel();
+ indicationView.animate().setListener(
+ new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) { }
+
+ @Override
+ public void onAnimationEnd(Animator animation) { }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mScreenOnHintAnimationRunning = false;
+ indicationView.setAlpha(1f);
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) { }
+ });
+
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ mStatusBar.onHintFinished();
+ mScreenOnHintAnimationRunning = false;
+ }
+ };
+ if (showSwipeLeftHint) {
+ mStatusBar.onLlsHintStarted();
+ startLlsHintFadeInAnimationPhase(r);
+ } else if (showUnlockHint) {
+ mStatusBar.onUnlockHintStarted();
+ startUnlockHintFadeInAnimationPhase(r);
+ } else if (showExpandHint) {
+ mStatusBar.onExpandHintStarted();
+ startExpandHintAnimation(r);
+ } else {
+ return;
+ }
+ indicationView.setAlpha(0);
+ mShowUnlockHint = showUnlockHint;
+ mShowExpandHint = showExpandHint;
+ mScreenOnHintAnimationRunning = true;
+ }
+
private ValueAnimator createHeightAnimator(float targetHeight) {
ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, targetHeight);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {