Merge "Don’t reset the menu state if the menu is showing during an update" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-05-25 20:08:54 +00:00
committed by Android (Google) Code Review

View File

@@ -140,7 +140,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
@Override @Override
public void createMenu(ViewGroup parent) { public void createMenu(ViewGroup parent) {
mParent = (ExpandableNotificationRow) parent; mParent = (ExpandableNotificationRow) parent;
createMenuViews(); createMenuViews(true /* resetState */);
} }
@Override @Override
@@ -164,7 +164,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
// Menu hasn't been created yet, no need to do anything. // Menu hasn't been created yet, no need to do anything.
return; return;
} }
createMenuViews(); createMenuViews(!isMenuVisible() /* resetState */);
} }
@Override @Override
@@ -179,7 +179,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
mParent.removeListener(); mParent.removeListener();
} }
private void createMenuViews() { private void createMenuViews(boolean resetState) {
// Filter the menu items based on the notification // Filter the menu items based on the notification
if (mParent != null && mParent.getStatusBarNotification() != null) { if (mParent != null && mParent.getStatusBarNotification() != null) {
int flags = mParent.getStatusBarNotification().getNotification().flags; int flags = mParent.getStatusBarNotification().getNotification().flags;
@@ -201,7 +201,14 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
for (int i = 0; i < mMenuItems.size(); i++) { for (int i = 0; i < mMenuItems.size(); i++) {
addMenuView(mMenuItems.get(i), mMenuContainer); addMenuView(mMenuItems.get(i), mMenuContainer);
} }
resetState(false /* notify */); if (resetState) {
resetState(false /* notify */);
} else {
mIconsPlaced = false;
setMenuLocation();
// If the # of items showing changed we need to update the snap position
showMenu(mParent, mOnLeft ? getSpaceForMenu() : -getSpaceForMenu(), 0 /* velocity */);
}
} }
private void resetState(boolean notify) { private void resetState(boolean notify) {