Loading packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java +7 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,11 @@ public class DismissView extends StackScrollerDecorView { public void setOnButtonClickListener(OnClickListener listener) { mContent.setOnClickListener(listener); } public boolean isOnEmptySpace(float touchX, float touchY) { return touchX < mContent.getX() || touchX > mContent.getX() + mContent.getWidth() || touchY < mContent.getY() || touchY > mContent.getY() + mContent.getHeight(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +7 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ import com.android.systemui.statusbar.stack.StackStateAnimator; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardAffordanceHelper.Callback { KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener { // Cap and total height of Roboto font. Needs to be adjusted when font for the big clock is // changed. Loading Loading @@ -197,6 +197,7 @@ public class NotificationPanelView extends PanelView implements findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); mNotificationStackScroller.setOverscrollTopChangedListener(this); mNotificationStackScroller.setOnEmptySpaceClickListener(this); mNotificationStackScroller.setScrollView(mScrollView); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.fast_out_slow_in); Loading Loading @@ -1867,4 +1868,9 @@ public class NotificationPanelView extends PanelView implements public void onScreenTurnedOn() { mKeyguardStatusView.refreshTime(); } @Override public void onEmptySpaceClicked(float x, float y) { onEmptySpaceClick(x); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +1 −1 Original line number Diff line number Diff line Loading @@ -903,7 +903,7 @@ public abstract class PanelView extends FrameLayout { * * @return whether the panel will be expanded after the action performed by this method */ private boolean onEmptySpaceClick(float x) { protected boolean onEmptySpaceClick(float x) { if (mHintAnimationRunning) { return true; } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +59 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.StackScrollerDecorView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.policy.ScrollAdapter; Loading Loading @@ -84,6 +85,9 @@ public class NotificationStackScrollLayout extends ViewGroup private int mLastMotionY; private int mDownX; private int mActivePointerId; private boolean mTouchIsClick; private float mInitialTouchX; private float mInitialTouchY; private int mSidePaddings; private Paint mDebugPaint; Loading Loading @@ -133,6 +137,7 @@ public class NotificationStackScrollLayout extends ViewGroup private OnChildLocationsChangedListener mListener; private OnOverscrollTopChangedListener mOverscrollTopChangedListener; private ExpandableView.OnHeightChangedListener mOnHeightChangedListener; private OnEmptySpaceClickListener mOnEmptySpaceClickListener; private boolean mNeedsAnimation; private boolean mTopPaddingNeedsAnimation; private boolean mDimmedNeedsAnimation; Loading Loading @@ -584,7 +589,9 @@ public class NotificationStackScrollLayout extends ViewGroup final int count = getChildCount(); for (int childIdx = 0; childIdx < count; childIdx++) { ExpandableView slidingChild = (ExpandableView) getChildAt(childIdx); if (slidingChild.getVisibility() == GONE) { if (slidingChild.getVisibility() == GONE || slidingChild instanceof StackScrollerDecorView || slidingChild == mSpeedBumpView) { continue; } float childTop = slidingChild.getTranslationY(); Loading Loading @@ -690,6 +697,7 @@ public class NotificationStackScrollLayout extends ViewGroup transformTouchEvent(ev, this, mScrollView); return mScrollView.onTouchEvent(ev); } handleEmptySpaceClick(ev); boolean expandWantsIt = false; if (!mSwipingInProgress && !mOnlyScrollingInThisMotion && isScrollingEnabled()) { if (isCancelOrUp) { Loading Loading @@ -1433,6 +1441,7 @@ public class NotificationStackScrollLayout extends ViewGroup transformTouchEvent(ev, mScrollView, this); } initDownStates(ev); handleEmptySpaceClick(ev); boolean expandWantsIt = false; if (!mSwipingInProgress && !mOnlyScrollingInThisMotion && isScrollingEnabled()) { expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); Loading @@ -1451,11 +1460,31 @@ public class NotificationStackScrollLayout extends ViewGroup return swipeWantsIt || scrollWantsIt || expandWantsIt || super.onInterceptTouchEvent(ev); } private void handleEmptySpaceClick(MotionEvent ev) { switch (ev.getActionMasked()) { case MotionEvent.ACTION_MOVE: if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > mTouchSlop || Math.abs(ev.getX() - mInitialTouchX) > mTouchSlop )) { mTouchIsClick = false; } break; case MotionEvent.ACTION_UP: if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD && mTouchIsClick && isBelowLastNotification(mInitialTouchX, mInitialTouchY)) { mOnEmptySpaceClickListener.onEmptySpaceClicked(mInitialTouchX, mInitialTouchY); } break; } } private void initDownStates(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { mExpandedInThisMotion = false; mOnlyScrollingInThisMotion = !mScroller.isFinished(); mDisallowScrollingInThisMotion = false; mTouchIsClick = true; mInitialTouchX = ev.getX(); mInitialTouchY = ev.getY(); } } Loading Loading @@ -1998,6 +2027,10 @@ public class NotificationStackScrollLayout extends ViewGroup this.mOnHeightChangedListener = mOnHeightChangedListener; } public void setOnEmptySpaceClickListener(OnEmptySpaceClickListener listener) { mOnEmptySpaceClickListener = listener; } public void onChildAnimationFinished() { requestChildrenUpdate(); } Loading Loading @@ -2248,6 +2281,24 @@ public class NotificationStackScrollLayout extends ViewGroup } } private boolean isBelowLastNotification(float touchX, float touchY) { ExpandableView lastChildNotGone = (ExpandableView) getLastChildNotGone(); if (lastChildNotGone == null) { return touchY > mIntrinsicPadding; } if (lastChildNotGone != mDismissView && lastChildNotGone != mEmptyShadeView) { return touchY > lastChildNotGone.getY() + lastChildNotGone.getActualHeight(); } else if (lastChildNotGone == mEmptyShadeView) { return touchY > mEmptyShadeView.getY(); } else { float dismissY = mDismissView.getY(); boolean belowDismissView = touchY > dismissY + mDismissView.getActualHeight(); return belowDismissView || (touchY > dismissY && mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), touchY - dismissY)); } } /** * A listener that is notified when some child locations might have changed. */ Loading @@ -2255,6 +2306,13 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout); } /** * A listener that is notified when the empty space below the notifications is clicked on */ public interface OnEmptySpaceClickListener { public void onEmptySpaceClicked(float x, float y); } /** * A listener that gets notified when the overscroll at the top has changed. */ Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java +7 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,11 @@ public class DismissView extends StackScrollerDecorView { public void setOnButtonClickListener(OnClickListener listener) { mContent.setOnClickListener(listener); } public boolean isOnEmptySpace(float touchX, float touchY) { return touchX < mContent.getX() || touchX > mContent.getX() + mContent.getWidth() || touchY < mContent.getY() || touchY > mContent.getY() + mContent.getHeight(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +7 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ import com.android.systemui.statusbar.stack.StackStateAnimator; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardAffordanceHelper.Callback { KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener { // Cap and total height of Roboto font. Needs to be adjusted when font for the big clock is // changed. Loading Loading @@ -197,6 +197,7 @@ public class NotificationPanelView extends PanelView implements findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); mNotificationStackScroller.setOverscrollTopChangedListener(this); mNotificationStackScroller.setOnEmptySpaceClickListener(this); mNotificationStackScroller.setScrollView(mScrollView); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.fast_out_slow_in); Loading Loading @@ -1867,4 +1868,9 @@ public class NotificationPanelView extends PanelView implements public void onScreenTurnedOn() { mKeyguardStatusView.refreshTime(); } @Override public void onEmptySpaceClicked(float x, float y) { onEmptySpaceClick(x); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +1 −1 Original line number Diff line number Diff line Loading @@ -903,7 +903,7 @@ public abstract class PanelView extends FrameLayout { * * @return whether the panel will be expanded after the action performed by this method */ private boolean onEmptySpaceClick(float x) { protected boolean onEmptySpaceClick(float x) { if (mHintAnimationRunning) { return true; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +59 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.StackScrollerDecorView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.policy.ScrollAdapter; Loading Loading @@ -84,6 +85,9 @@ public class NotificationStackScrollLayout extends ViewGroup private int mLastMotionY; private int mDownX; private int mActivePointerId; private boolean mTouchIsClick; private float mInitialTouchX; private float mInitialTouchY; private int mSidePaddings; private Paint mDebugPaint; Loading Loading @@ -133,6 +137,7 @@ public class NotificationStackScrollLayout extends ViewGroup private OnChildLocationsChangedListener mListener; private OnOverscrollTopChangedListener mOverscrollTopChangedListener; private ExpandableView.OnHeightChangedListener mOnHeightChangedListener; private OnEmptySpaceClickListener mOnEmptySpaceClickListener; private boolean mNeedsAnimation; private boolean mTopPaddingNeedsAnimation; private boolean mDimmedNeedsAnimation; Loading Loading @@ -584,7 +589,9 @@ public class NotificationStackScrollLayout extends ViewGroup final int count = getChildCount(); for (int childIdx = 0; childIdx < count; childIdx++) { ExpandableView slidingChild = (ExpandableView) getChildAt(childIdx); if (slidingChild.getVisibility() == GONE) { if (slidingChild.getVisibility() == GONE || slidingChild instanceof StackScrollerDecorView || slidingChild == mSpeedBumpView) { continue; } float childTop = slidingChild.getTranslationY(); Loading Loading @@ -690,6 +697,7 @@ public class NotificationStackScrollLayout extends ViewGroup transformTouchEvent(ev, this, mScrollView); return mScrollView.onTouchEvent(ev); } handleEmptySpaceClick(ev); boolean expandWantsIt = false; if (!mSwipingInProgress && !mOnlyScrollingInThisMotion && isScrollingEnabled()) { if (isCancelOrUp) { Loading Loading @@ -1433,6 +1441,7 @@ public class NotificationStackScrollLayout extends ViewGroup transformTouchEvent(ev, mScrollView, this); } initDownStates(ev); handleEmptySpaceClick(ev); boolean expandWantsIt = false; if (!mSwipingInProgress && !mOnlyScrollingInThisMotion && isScrollingEnabled()) { expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); Loading @@ -1451,11 +1460,31 @@ public class NotificationStackScrollLayout extends ViewGroup return swipeWantsIt || scrollWantsIt || expandWantsIt || super.onInterceptTouchEvent(ev); } private void handleEmptySpaceClick(MotionEvent ev) { switch (ev.getActionMasked()) { case MotionEvent.ACTION_MOVE: if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > mTouchSlop || Math.abs(ev.getX() - mInitialTouchX) > mTouchSlop )) { mTouchIsClick = false; } break; case MotionEvent.ACTION_UP: if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD && mTouchIsClick && isBelowLastNotification(mInitialTouchX, mInitialTouchY)) { mOnEmptySpaceClickListener.onEmptySpaceClicked(mInitialTouchX, mInitialTouchY); } break; } } private void initDownStates(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { mExpandedInThisMotion = false; mOnlyScrollingInThisMotion = !mScroller.isFinished(); mDisallowScrollingInThisMotion = false; mTouchIsClick = true; mInitialTouchX = ev.getX(); mInitialTouchY = ev.getY(); } } Loading Loading @@ -1998,6 +2027,10 @@ public class NotificationStackScrollLayout extends ViewGroup this.mOnHeightChangedListener = mOnHeightChangedListener; } public void setOnEmptySpaceClickListener(OnEmptySpaceClickListener listener) { mOnEmptySpaceClickListener = listener; } public void onChildAnimationFinished() { requestChildrenUpdate(); } Loading Loading @@ -2248,6 +2281,24 @@ public class NotificationStackScrollLayout extends ViewGroup } } private boolean isBelowLastNotification(float touchX, float touchY) { ExpandableView lastChildNotGone = (ExpandableView) getLastChildNotGone(); if (lastChildNotGone == null) { return touchY > mIntrinsicPadding; } if (lastChildNotGone != mDismissView && lastChildNotGone != mEmptyShadeView) { return touchY > lastChildNotGone.getY() + lastChildNotGone.getActualHeight(); } else if (lastChildNotGone == mEmptyShadeView) { return touchY > mEmptyShadeView.getY(); } else { float dismissY = mDismissView.getY(); boolean belowDismissView = touchY > dismissY + mDismissView.getActualHeight(); return belowDismissView || (touchY > dismissY && mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), touchY - dismissY)); } } /** * A listener that is notified when some child locations might have changed. */ Loading @@ -2255,6 +2306,13 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout); } /** * A listener that is notified when the empty space below the notifications is clicked on */ public interface OnEmptySpaceClickListener { public void onEmptySpaceClicked(float x, float y); } /** * A listener that gets notified when the overscroll at the top has changed. */ Loading