diff options
3 files changed, 61 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java index 086a266c443a..e312d5850fb1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java @@ -423,6 +423,7 @@ public class KeyguardPageSwipeHelper { return; } if (!animate) { + view.animate().cancel(); view.setAlpha(alpha); view.setScaleX(scale); view.setScaleY(scale); @@ -465,6 +466,13 @@ public class KeyguardPageSwipeHelper { } public void reset() { + if (mSwipeAnimator != null) { + mSwipeAnimator.cancel(); + } + ArrayList<View> targetViews = mCallback.getTranslationViews(); + for (View view : targetViews) { + view.animate().cancel(); + } setTranslation(0.0f, true); mSwipingInProgress = false; } 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 772d0e7e9a3b..1f3098d94d41 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -27,6 +27,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.ViewConfiguration; +import android.view.ViewTreeObserver; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.FrameLayout; @@ -67,6 +68,11 @@ public abstract class PanelView extends FrameLayout { private VelocityTrackerInterface mVelocityTracker; private FlingAnimationUtils mFlingAnimationUtils; + /** + * Whether an instant expand request is currently pending and we are just waiting for layout. + */ + private boolean mInstantExpanding; + PanelBar mBar; protected int mMaxPanelHeight = -1; @@ -128,6 +134,9 @@ public abstract class PanelView extends FrameLayout { @Override public boolean onTouchEvent(MotionEvent event) { + if (mInstantExpanding) { + return false; + } /* * We capture touch events here and update the expand height here in case according to @@ -263,6 +272,9 @@ public abstract class PanelView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent event) { + if (mInstantExpanding) { + return false; + } /* * If the user drags anywhere inside the panel we intercept it if he moves his finger @@ -556,6 +568,41 @@ public abstract class PanelView extends FrameLayout { } } + public void instantExpand() { + mInstantExpanding = true; + abortAnimations(); + if (mTracking) { + onTrackingStopped(true /* expands */); // The panel is expanded after this call. + onExpandingFinished(); + } + setVisibility(VISIBLE); + + // Wait for window manager to pickup the change, so we know the maximum height of the panel + // then. + getViewTreeObserver().addOnGlobalLayoutListener( + new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if (mStatusBar.getStatusBarWindow().getHeight() + != mStatusBar.getStatusBarHeight()) { + getViewTreeObserver().removeOnGlobalLayoutListener(this); + setExpandedFraction(1f); + mInstantExpanding = false; + } + } + }); + + // Make sure a layout really happens. + requestLayout(); + } + + private void abortAnimations() { + cancelPeek(); + if (mHeightAnimator != null) { + mHeightAnimator.cancel(); + } + } + protected void startUnlockHintAnimation() { // We don't need to hint the user if an animation is already running or the user is changing diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 522321770993..d7b1d35ea48f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -831,6 +831,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, return mStatusBarView; } + public StatusBarWindowView getStatusBarWindow() { + return mStatusBarWindow; + } + @Override protected WindowManager.LayoutParams getSearchLayoutParams(LayoutParams layoutParams) { boolean opaque = false; @@ -2966,22 +2970,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private void instantExpandNotificationsPanel() { - // Make our window larger and the panel visible. + // Make our window larger and the panel expanded. makeExpandedVisible(true); - mNotificationPanel.setVisibility(View.VISIBLE); - - // Wait for window manager to pickup the change, so we know the maximum height of the panel - // then. - mNotificationPanel.getViewTreeObserver().addOnGlobalLayoutListener( - new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - if (mStatusBarWindow.getHeight() != getStatusBarHeight()) { - mNotificationPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this); - mNotificationPanel.setExpandedFraction(1); - } - } - }); + mNotificationPanel.instantExpand(); } private void instantCollapseNotificationPanel() { |