am 8c5b15c6: Merge "Fix a bug in action menu measurement" into klp-dev
* commit '8c5b15c628b89c4fb832b7311e5d13ccea4aff04': Fix a bug in action menu measurement
This commit is contained in:
@@ -216,6 +216,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||
}
|
||||
super.updateMenuView(cleared);
|
||||
|
||||
((View) mMenuView).requestLayout();
|
||||
|
||||
if (mMenu != null) {
|
||||
final ArrayList<MenuItemImpl> actionItems = mMenu.getActionItems();
|
||||
final int count = actionItems.size();
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.internal.view.menu;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -27,6 +25,7 @@ import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.LinearLayout;
|
||||
import com.android.internal.R;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -101,7 +100,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo
|
||||
|
||||
// Special formatting can change whether items can fit as action buttons.
|
||||
// Kick the menu and update presenters when this changes.
|
||||
final int widthSize = MeasureSpec.getMode(widthMeasureSpec);
|
||||
final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
if (mFormatItems && mMenu != null && widthSize != mFormatItemsWidth) {
|
||||
mFormatItemsWidth = widthSize;
|
||||
mMenu.onItemsChanged(true);
|
||||
|
||||
@@ -1034,6 +1034,10 @@ public class MenuBuilder implements Menu {
|
||||
* to avoid inadvertent reordering that may break the app's intended design.
|
||||
*/
|
||||
public void flagActionItems() {
|
||||
// Important side effect: if getVisibleItems is stale it may refresh,
|
||||
// which can affect action items staleness.
|
||||
final ArrayList<MenuItemImpl> visibleItems = getVisibleItems();
|
||||
|
||||
if (!mIsActionItemsStale) {
|
||||
return;
|
||||
}
|
||||
@@ -1052,7 +1056,6 @@ public class MenuBuilder implements Menu {
|
||||
if (flagged) {
|
||||
mActionItems.clear();
|
||||
mNonActionItems.clear();
|
||||
ArrayList<MenuItemImpl> visibleItems = getVisibleItems();
|
||||
final int itemsSize = visibleItems.size();
|
||||
for (int i = 0; i < itemsSize; i++) {
|
||||
MenuItemImpl item = visibleItems.get(i);
|
||||
|
||||
Reference in New Issue
Block a user