Merge "Make sure to remove child views when recreating notification menu row" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1e943b3ef0
@@ -120,6 +120,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
|
||||
@Override
|
||||
public void createMenu(ViewGroup parent) {
|
||||
mParent = (ExpandableNotificationRow) parent;
|
||||
if (mMenuContainer != null) {
|
||||
mMenuContainer.removeAllViews();
|
||||
}
|
||||
mMenuContainer = new FrameLayout(mContext);
|
||||
for (int i = 0; i < mMenuItems.size(); i++) {
|
||||
addMenuView(mMenuItems.get(i), mMenuContainer);
|
||||
|
||||
@@ -44,4 +44,11 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
|
||||
ViewUtils.detachView(row.getMenuView());
|
||||
TestableLooper.get(this).processAllMessages();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecreateMenu() {
|
||||
NotificationMenuRowPlugin row = new NotificationMenuRow(mContext);
|
||||
row.createMenu(null);
|
||||
row.createMenu(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user