summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-10-15 17:19:30 -0700
committerAlan Viverette <alanv@google.com>2014-10-15 17:19:30 -0700
commit29632521c36548d71b610fc4de864281bab4dfb4 (patch)
tree9f6a11a89745b82fa8f18d943d84d181f124339c /core/java/com
parent3d5ecf13e01da262b95ff78486297af3a0601d0c (diff)
downloadframeworks_base-29632521c36548d71b610fc4de864281bab4dfb4.zip
frameworks_base-29632521c36548d71b610fc4de864281bab4dfb4.tar.gz
frameworks_base-29632521c36548d71b610fc4de864281bab4dfb4.tar.bz2
Add style support to PopupMenu, clean up constructor javadoc
BUG: 18002523 Change-Id: Ice492686b814460248ccbe9727c64dd002e7ed7a
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/view/menu/MenuPopupHelper.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index 40f58e9..99bb1ac 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -54,6 +54,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
private final boolean mOverflowOnly;
private final int mPopupMaxWidth;
private final int mPopupStyleAttr;
+ private final int mPopupStyleRes;
private View mAnchorView;
private ListPopupWindow mPopup;
@@ -73,21 +74,27 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
private int mDropDownGravity = Gravity.NO_GRAVITY;
public MenuPopupHelper(Context context, MenuBuilder menu) {
- this(context, menu, null, false, com.android.internal.R.attr.popupMenuStyle);
+ this(context, menu, null, false, com.android.internal.R.attr.popupMenuStyle, 0);
}
public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView) {
- this(context, menu, anchorView, false, com.android.internal.R.attr.popupMenuStyle);
+ this(context, menu, anchorView, false, com.android.internal.R.attr.popupMenuStyle, 0);
}
public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView,
boolean overflowOnly, int popupStyleAttr) {
+ this(context, menu, anchorView, overflowOnly, popupStyleAttr, 0);
+ }
+
+ public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView,
+ boolean overflowOnly, int popupStyleAttr, int popupStyleRes) {
mContext = context;
mInflater = LayoutInflater.from(context);
mMenu = menu;
mAdapter = new MenuAdapter(mMenu);
mOverflowOnly = overflowOnly;
mPopupStyleAttr = popupStyleAttr;
+ mPopupStyleRes = popupStyleRes;
final Resources res = context.getResources();
mPopupMaxWidth = Math.max(res.getDisplayMetrics().widthPixels / 2,
@@ -122,7 +129,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
}
public boolean tryShow() {
- mPopup = new ListPopupWindow(mContext, null, mPopupStyleAttr);
+ mPopup = new ListPopupWindow(mContext, null, mPopupStyleAttr, mPopupStyleRes);
mPopup.setOnDismissListener(this);
mPopup.setOnItemClickListener(this);
mPopup.setAdapter(mAdapter);