mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 947281 - Fix calcuations for how many actionbar items to show. r=sriram,margaret
This commit is contained in:
parent
2eace53387
commit
348ee881e7
@ -119,9 +119,12 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB
|
||||
maxWidth = mActionButtonBar.getMeasuredWidth();
|
||||
}
|
||||
|
||||
// Since we don't know how many items will be added, we always reserve space for the overflow menu
|
||||
mMenuButton.measure(SPEC, SPEC);
|
||||
maxWidth -= mMenuButton.getMeasuredWidth();
|
||||
// If the menu button is already visible, no need to account for it
|
||||
if (mMenuButton.getVisibility() == View.GONE) {
|
||||
// Since we don't know how many items will be added, we always reserve space for the overflow menu
|
||||
mMenuButton.measure(SPEC, SPEC);
|
||||
maxWidth -= mMenuButton.getMeasuredWidth();
|
||||
}
|
||||
|
||||
if (mActionButtonsWidth <= 0) {
|
||||
mActionButtonsWidth = 0;
|
||||
@ -142,12 +145,14 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB
|
||||
mActionButtonBar.addView(actionItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* GeckoMenu.ActionItemBarPresenter */
|
||||
@Override
|
||||
public void removeActionItem(View actionItem) {
|
||||
actionItem.measure(SPEC, SPEC);
|
||||
mActionButtonsWidth -= actionItem.getMeasuredWidth();
|
||||
mActionButtonBar.removeView(actionItem);
|
||||
}
|
||||
|
@ -171,11 +171,12 @@ public class GeckoMenu extends ListView
|
||||
}
|
||||
});
|
||||
|
||||
mActionItems.put(menuItem, actionView);
|
||||
mActionItemBarPresenter.addActionItem(actionView);
|
||||
mItems.add(menuItem);
|
||||
|
||||
return true;
|
||||
if (mActionItemBarPresenter.addActionItem(actionView)) {
|
||||
mActionItems.put(menuItem, actionView);
|
||||
mItems.add(menuItem);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user