Merge "Not showing menu buttons for any headsup notification" into qt-dev

This commit is contained in:
Shawn Lin
2019-05-21 01:15:17 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 2 deletions

View File

@@ -915,7 +915,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
if (child.getVisibility() != View.GONE if (child.getVisibility() != View.GONE
&& child instanceof ExpandableNotificationRow) { && child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child; ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if ((row.isPinned() || row.isHeadsUpAnimatingAway()) && row.getTranslation() < 0) { if ((row.isPinned() || row.isHeadsUpAnimatingAway()) && row.getTranslation() < 0
&& row.getProvider().shouldShowGutsOnSnapOpen()) {
top = Math.min(top, row.getTranslationY()); top = Math.min(top, row.getTranslationY());
bottom = Math.max(bottom, row.getTranslationY() + row.getActualHeight()); bottom = Math.max(bottom, row.getTranslationY() + row.getActualHeight());
} }
@@ -4380,6 +4381,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mStackScrollAlgorithm.setIsExpanded(isExpanded); mStackScrollAlgorithm.setIsExpanded(isExpanded);
mAmbientState.setShadeExpanded(isExpanded); mAmbientState.setShadeExpanded(isExpanded);
mStateAnimator.setShadeExpanded(isExpanded); mStateAnimator.setShadeExpanded(isExpanded);
mSwipeHelper.setIsExpanded(isExpanded);
if (changed) { if (changed) {
if (!mIsExpanded) { if (!mIsExpanded) {
mGroupManager.collapseAllGroups(); mGroupManager.collapseAllGroups();

View File

@@ -48,6 +48,7 @@ class NotificationSwipeHelper extends SwipeHelper
private static final long SWIPE_MENU_TIMING = 200; private static final long SWIPE_MENU_TIMING = 200;
private NotificationMenuRowPlugin mCurrMenuRow; private NotificationMenuRowPlugin mCurrMenuRow;
private boolean mIsExpanded;
public NotificationSwipeHelper(int swipeDirection, NotificationCallback callback, public NotificationSwipeHelper(int swipeDirection, NotificationCallback callback,
Context context, NotificationMenuRowPlugin.OnMenuEventListener menuListener) { Context context, NotificationMenuRowPlugin.OnMenuEventListener menuListener) {
@@ -97,6 +98,10 @@ class NotificationSwipeHelper extends SwipeHelper
return mFalsingCheck; return mFalsingCheck;
} }
public void setIsExpanded(boolean isExpanded) {
mIsExpanded = isExpanded;
}
@Override @Override
protected void onChildSnappedBack(View animView, float targetLeft) { protected void onChildSnappedBack(View animView, float targetLeft) {
if (mCurrMenuRow != null && targetLeft == 0) { if (mCurrMenuRow != null && targetLeft == 0) {
@@ -200,7 +205,9 @@ class NotificationSwipeHelper extends SwipeHelper
boolean slowSwipedFarEnough = swipedEnoughToShowMenu(menuRow) && isSlowSwipe; boolean slowSwipedFarEnough = swipedEnoughToShowMenu(menuRow) && isSlowSwipe;
boolean isFastNonDismissGesture = boolean isFastNonDismissGesture =
gestureFastEnough && !gestureTowardsMenu && !isDismissGesture; gestureFastEnough && !gestureTowardsMenu && !isDismissGesture;
boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough || isFastNonDismissGesture; boolean isAbleToShowMenu = menuRow.shouldShowGutsOnSnapOpen() || mIsExpanded;
boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough
|| (isFastNonDismissGesture && isAbleToShowMenu);
int menuSnapTarget = menuRow.getMenuSnapTarget(); int menuSnapTarget = menuRow.getMenuSnapTarget();
boolean isNonFalseMenuRevealingGesture = boolean isNonFalseMenuRevealingGesture =
!isFalseGesture(ev) && isMenuRevealingGestureAwayFromMenu; !isFalseGesture(ev) && isMenuRevealingGestureAwayFromMenu;