summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java113
1 files changed, 71 insertions, 42 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 729f965..d7c1acc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -263,6 +263,7 @@ public class NotificationPanelView extends PanelView implements
private final int mScreenHeight;
private LiveLockScreenController mLiveLockscreenController;
private final GestureDetector mGestureDetector;
+ private ViewLinker mViewLinker;
private enum SwipeLockedDirection {
UNKNOWN,
@@ -274,12 +275,12 @@ public class NotificationPanelView extends PanelView implements
SwipeHelper.SimpleCallback mSwipeCallback = new SwipeHelper.SimpleCallback() {
@Override
public View getChildAtPosition(MotionEvent ev) {
- return mNotificationStackScroller;
+ return mViewLinker.getParent();
}
@Override
public View getChildContentView(View v) {
- return mNotificationStackScroller;
+ return mViewLinker.getParent();
}
@Override
@@ -311,11 +312,10 @@ public class NotificationPanelView extends PanelView implements
mLiveLockscreenController.getLiveLockScreenView()
.onLockscreenSlideOffsetChanged(swipeProgress);
- // Ensures the status view and notifications are kept in sync when
- // being swiped away
- mKeyguardStatusView.setTranslationX(mNotificationStackScroller.getTranslationX());
- mKeyguardStatusView.setAlpha(mNotificationStackScroller.getAlpha());
- mKeyguardStatusBar.setAlpha(mNotificationStackScroller.getAlpha());
+ // Fade out scrim background
+ float alpha = ScrimController.SCRIM_BEHIND_ALPHA_KEYGUARD - (1f - swipeProgress);
+ alpha = Math.max(0, alpha);
+ mStatusBar.getScrimController().setScrimBehindColor(alpha);
return false;
}
@@ -348,7 +348,7 @@ public class NotificationPanelView extends PanelView implements
final int gradientEnd = res.getColor(R.color.live_lockscreen_gradient_end);
mGestureDetector = new GestureDetector(getContext(),
new GestureDetector.SimpleOnGestureListener() {
- public float mDown;
+ private float mDown;
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
@@ -359,12 +359,14 @@ public class NotificationPanelView extends PanelView implements
mCanDismissKeyguard = true;
mShowingExternalKeyguard = false;
mStatusBar.showBouncer();
+ mStatusBar.unfocusKeyguardExternalView();
return true;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
float delta = mDown - e2.getRawY();
+ delta = Math.max(0, delta);
float screenHeightHalf = (float) mScreenHeight / 2f;
int color = (Integer) ArgbEvaluator.getInstance()
.evaluate(delta / screenHeightHalf, gradientStart, gradientEnd);
@@ -430,6 +432,11 @@ public class NotificationPanelView extends PanelView implements
mDozeAnimationInterpolator = AnimationUtils.loadInterpolator(getContext(),
android.R.interpolator.linear_out_slow_in);
+ mViewLinker = new ViewLinker<NotificationStackScrollLayout>(mNotificationStackScroller,
+ new ViewLinker.LinkInfo(mKeyguardStatusBar, ViewLinker.LINK_ALPHA),
+ new ViewLinker.LinkInfo(mKeyguardStatusView, ViewLinker.LINK_ALPHA
+ | ViewLinker.LINK_TRANSLATION));
+
mKeyguardBottomArea = (KeyguardBottomAreaView) View.inflate(getContext(),
R.layout.keyguard_bottom_area, null);
/** Keyguard bottom area lives in a separate window, and as such,
@@ -438,15 +445,16 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.setOnInterceptTouchListener(new KeyguardBottomAreaView.OnInterceptTouchEventListener() {
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
- boolean intercept = mAfforanceHelper.onInterceptTouchEvent(e);
- if (!intercept) {
- if (mShowingExternalKeyguard) {
- // Handles swipe up to fade/dismiss when showing
- // live lock screen
+ boolean intercept = false;
+ if (mShowingExternalKeyguard) {
+ // Handles swipe up to fade/dismiss when showing
+ // live lock screen
+ intercept = mAfforanceHelper.onInterceptTouchEvent(e);
+ if (!intercept) {
intercept = mGestureDetector.onTouchEvent(e);
- } else {
- intercept = NotificationPanelView.this.onInterceptTouchEvent(e);
}
+ } else {
+ intercept = NotificationPanelView.this.onInterceptTouchEvent(e);
}
return intercept;
}
@@ -455,19 +463,24 @@ public class NotificationPanelView extends PanelView implements
@Override
public boolean onTouch(View v, MotionEvent e) {
int action = e.getAction();
- // Ensure we collapse and clear fade
- if (action == MotionEvent.ACTION_UP ||
- action == MotionEvent.ACTION_CANCEL) {
+
+ boolean isCancelOrUp = action == MotionEvent.ACTION_UP ||
+ action == MotionEvent.ACTION_CANCEL;
+ if (isCancelOrUp) {
mKeyguardBottomArea.setBackground(null);
}
- boolean intercept = mAfforanceHelper.onTouchEvent(e);
- if (!intercept) {
- if (mShowingExternalKeyguard) {
+ boolean intercept = false;
+ if (mShowingExternalKeyguard) {
+ intercept = mAfforanceHelper.onTouchEvent(e);
+ if (isCancelOrUp) {
+ mKeyguardBottomArea.expand(false);
+ }
+ if (!intercept) {
intercept = mGestureDetector.onTouchEvent(e);
- } else {
- intercept = NotificationPanelView.this.onTouchEvent(e);
}
+ } else {
+ intercept = NotificationPanelView.this.onTouchEvent(e);
}
return intercept;
}
@@ -491,6 +504,10 @@ public class NotificationPanelView extends PanelView implements
});
}
+ public boolean isAffordanceSwipeInProgress() {
+ return mAfforanceHelper.isSwipingInProgress();
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -807,7 +824,7 @@ public class NotificationPanelView extends PanelView implements
return true;
}
- if (isKeyguardInteractiveAndShowing()) {
+ if (isKeyguardInteractiveAndShowing() || mStatusBar.isKeyguardShowingMedia()) {
return super.onInterceptTouchEvent(event);
}
@@ -987,7 +1004,7 @@ public class NotificationPanelView extends PanelView implements
}
if ((!mIsExpanding || mHintAnimationRunning)
&& !mQsExpanded
- && mStatusBar.getBarState() != StatusBarState.SHADE) {
+ && (mStatusBar.getBarState() != StatusBarState.SHADE || mShowingExternalKeyguard)) {
mAfforanceHelper.onTouchEvent(event);
}
if (mOnlyAffordanceInThisMotion) {
@@ -1002,26 +1019,29 @@ public class NotificationPanelView extends PanelView implements
updateVerticalPanelPosition(event.getX());
}
- if (isKeyguardInteractiveAndShowing()) {
+ if (isKeyguardInteractiveAndShowing() || mStatusBar.isKeyguardShowingMedia()) {
super.onTouchEvent(event);
return true;
}
- if (!mSwipeHelper.isDragging() && super.onTouchEvent(event)) {
- mLockedDirection = SwipeLockedDirection.VERTICAL;
- return true;
- }
-
if ((!mIsExpanding || mHintAnimationRunning)
&& !mQsExpanded
&& mLockedDirection != SwipeLockedDirection.VERTICAL
&& mStatusBar.getBarState() != StatusBarState.SHADE) {
- if (mSwipeHelper.onTouchEvent(event)) {
+ mSwipeHelper.onTouchEvent(event);
+ if (mSwipeHelper.isDragging()) {
mLockedDirection = SwipeLockedDirection.HORIZONTAL;
+ }
+ if (mLockedDirection == SwipeLockedDirection.HORIZONTAL) {
+ requestDisallowInterceptTouchEvent(true);
return true;
}
}
- return false;
+
+ if (super.onTouchEvent(event)) {
+ mLockedDirection = SwipeLockedDirection.VERTICAL;
+ }
+ return true;
}
private boolean isKeyguardInteractiveAndShowing() {
@@ -2028,9 +2048,6 @@ public class NotificationPanelView extends PanelView implements
alpha = getNotificationsTopY()
/
(mKeyguardStatusBar.getHeight() + mNotificationsHeaderCollideDistance);
- } else if (mStatusBar.getBarState() == StatusBarState.SHADE &&
- mLiveLockscreenController.isShowingLiveLockScreenView()) {
- alpha = 1;
} else {
// In SHADE_LOCKED, the top card is already really close to the header. Hide it as
@@ -2043,6 +2060,9 @@ public class NotificationPanelView extends PanelView implements
}
private void updateHeaderKeyguardAlpha() {
+ if (mSwipeHelper.isDragging()) {
+ return;
+ }
float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2);
mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion)
* mKeyguardStatusBarAnimateAlpha);
@@ -2057,6 +2077,9 @@ public class NotificationPanelView extends PanelView implements
private void updateKeyguardBottomAreaAlpha() {
float alpha = Math.min(getKeyguardContentsAlpha(), 1 - getQsExpansionFraction());
+ if (mShowingExternalKeyguard) {
+ alpha = 1f;
+ }
mKeyguardBottomArea.setAlpha(alpha);
mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
@@ -2280,6 +2303,7 @@ public class NotificationPanelView extends PanelView implements
mLaunchAnimationEndRunnable.run();
mLaunchAnimationEndRunnable = null;
}
+ mKeyguardBottomArea.setVisibility(View.GONE);
}
@Override
@@ -2836,16 +2860,20 @@ public class NotificationPanelView extends PanelView implements
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
+ View statusBarView = mStatusBar.getStatusBarWindow();
+ if (valueAnimator.getAnimatedFraction() > 0 &&
+ statusBarView.getVisibility() != View.VISIBLE) {
+ statusBarView.setVisibility(View.VISIBLE);
+ }
float translationX = (Float) valueAnimator.getAnimatedValue();
float alpha = valueAnimator.getAnimatedFraction();
- mNotificationStackScroller.setTranslationX(translationX);
- mNotificationStackScroller.setAlpha(alpha);
-
- mKeyguardStatusView.setTranslationX(translationX);
- mKeyguardStatusView.setAlpha(alpha);
+ mViewLinker.getParent().setTranslationX(translationX);
+ mViewLinker.getParent().setAlpha(alpha);
- mKeyguardStatusBar.setAlpha(alpha);
+ float alpha1 = ScrimController.SCRIM_BEHIND_ALPHA_KEYGUARD * alpha;
+ alpha1 = Math.max(0, alpha1);
+ mStatusBar.getScrimController().setScrimBehindColor(alpha1);
mLiveLockscreenController.getLiveLockScreenView()
.onLockscreenSlideOffsetChanged(alpha);
}
@@ -2866,6 +2894,7 @@ public class NotificationPanelView extends PanelView implements
mKeyguardStatusView.setTranslationX(mNotificationStackScroller.getTranslationX());
mKeyguardStatusBar.setAlpha(0f);
+ mStatusBar.getScrimController().setScrimBehindColor(0f);
ValueAnimator animator = ValueAnimator.ofFloat(
mNotificationStackScroller.getTranslationX(),
0f);