Loading api/current.xml +46 −0 Original line number Diff line number Diff line Loading @@ -2176,6 +2176,17 @@ visibility="public" > </field> <field name="actionLayout" type="int" transient="false" volatile="false" value="16843580" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="actionModeBackground" type="int" transient="false" Loading Loading @@ -2220,6 +2231,17 @@ visibility="public" > </field> <field name="actionViewClass" type="int" transient="false" volatile="false" value="16843581" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="activityCloseEnterAnimation" type="int" transient="false" Loading Loading @@ -193228,6 +193250,17 @@ deprecated="not deprecated" visibility="public" > <method name="getActionView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getAlphabeticShortcut" return="char" abstract="true" Loading Loading @@ -193404,6 +193437,19 @@ visibility="public" > </method> <method name="setActionView" return="android.view.MenuItem" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setAlphabeticShortcut" return="android.view.MenuItem" abstract="true" core/java/android/view/MenuInflater.java +24 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package android.view; import java.io.IOException; import java.lang.reflect.Method; import com.android.internal.view.menu.MenuItemImpl; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; Loading @@ -29,7 +28,9 @@ import android.content.res.XmlResourceParser; import android.util.AttributeSet; import android.util.Xml; import com.android.internal.view.menu.MenuItemImpl; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; /** * This class is used to instantiate menu XML files into Menu objects. Loading @@ -52,6 +53,8 @@ public class MenuInflater { private static final int NO_ID = 0; private static final Class<?>[] ACTION_VIEW_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class}; private Context mContext; /** Loading Loading @@ -250,6 +253,9 @@ public class MenuInflater { */ private int itemShowAsAction; private int itemActionViewLayout; private String itemActionViewClassName; private String itemListenerMethodName; private static final int defaultGroupId = NO_ID; Loading Loading @@ -325,6 +331,8 @@ public class MenuInflater { itemEnabled = a.getBoolean(com.android.internal.R.styleable.MenuItem_enabled, groupEnabled); itemShowAsAction = a.getInt(com.android.internal.R.styleable.MenuItem_showAsAction, -1); itemListenerMethodName = a.getString(com.android.internal.R.styleable.MenuItem_onClick); itemActionViewLayout = a.getResourceId(com.android.internal.R.styleable.MenuItem_actionLayout, 0); itemActionViewClassName = a.getString(com.android.internal.R.styleable.MenuItem_actionViewClass); a.recycle(); Loading Loading @@ -368,6 +376,19 @@ public class MenuInflater { impl.setExclusiveCheckable(true); } } if (itemActionViewClassName != null) { try { final Class<?> clazz = Class.forName(itemActionViewClassName); Constructor<?> c = clazz.getConstructor(ACTION_VIEW_CONSTRUCTOR_SIGNATURE); item.setActionView((View) c.newInstance(mContext)); } catch (Exception e) { throw new InflateException(e); } } else if (itemActionViewLayout > 0) { final LayoutInflater inflater = LayoutInflater.from(mContext); item.setActionView(inflater.inflate(itemActionViewLayout, null)); } } public void addItem() { Loading core/java/android/view/MenuItem.java +23 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,29 @@ public interface MenuItem { * {@link #SHOW_AS_ACTION_NEVER}. SHOW_AS_ACTION_NEVER is the default. * * @see android.app.ActionBar * @see #setActionView(View) */ public void setShowAsAction(int actionEnum); /** * Set an action view for this menu item. An action view will be displayed in place * of an automatically generated menu item element in the UI when this item is shown * as an action within a parent. * * @param view View to use for presenting this item to the user. * @return This Item so additional setters can be called. * * @see #setShowAsAction(int) */ public MenuItem setActionView(View view); /** * Returns the currently set action view for this menu item. * * @return This item's action view * * @see #setActionView(View) * @see #setShowAsAction(int) */ public View getActionView(); } No newline at end of file core/java/com/android/internal/view/menu/ActionMenuItem.java +10 −1 Original line number Diff line number Diff line Loading @@ -19,9 +19,10 @@ package com.android.internal.view.menu; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.view.ContextMenu.ContextMenuInfo; import android.view.MenuItem; import android.view.SubMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.View; /** * @hide Loading Loading @@ -222,4 +223,12 @@ public class ActionMenuItem implements MenuItem { public void setShowAsAction(int show) { // Do nothing. ActionMenuItems always show as action buttons. } public MenuItem setActionView(View actionView) { throw new UnsupportedOperationException(); } public View getActionView() { return null; } } core/java/com/android/internal/view/menu/ActionMenuView.java +8 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.LinearLayout; Loading Loading @@ -158,8 +159,13 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo for (int i = 0; i < itemCount; i++) { final MenuItemImpl itemData = itemsToShow.get(i); addItemView((ActionMenuItemView) itemData.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, this)); final View actionView = itemData.getActionView(); if (actionView != null) { addView(actionView); } else { addItemView((ActionMenuItemView) itemData.getItemView( MenuBuilder.TYPE_ACTION_BUTTON, this)); } } if (reserveOverflow) { Loading Loading
api/current.xml +46 −0 Original line number Diff line number Diff line Loading @@ -2176,6 +2176,17 @@ visibility="public" > </field> <field name="actionLayout" type="int" transient="false" volatile="false" value="16843580" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="actionModeBackground" type="int" transient="false" Loading Loading @@ -2220,6 +2231,17 @@ visibility="public" > </field> <field name="actionViewClass" type="int" transient="false" volatile="false" value="16843581" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="activityCloseEnterAnimation" type="int" transient="false" Loading Loading @@ -193228,6 +193250,17 @@ deprecated="not deprecated" visibility="public" > <method name="getActionView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getAlphabeticShortcut" return="char" abstract="true" Loading Loading @@ -193404,6 +193437,19 @@ visibility="public" > </method> <method name="setActionView" return="android.view.MenuItem" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setAlphabeticShortcut" return="android.view.MenuItem" abstract="true"
core/java/android/view/MenuInflater.java +24 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package android.view; import java.io.IOException; import java.lang.reflect.Method; import com.android.internal.view.menu.MenuItemImpl; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; Loading @@ -29,7 +28,9 @@ import android.content.res.XmlResourceParser; import android.util.AttributeSet; import android.util.Xml; import com.android.internal.view.menu.MenuItemImpl; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; /** * This class is used to instantiate menu XML files into Menu objects. Loading @@ -52,6 +53,8 @@ public class MenuInflater { private static final int NO_ID = 0; private static final Class<?>[] ACTION_VIEW_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class}; private Context mContext; /** Loading Loading @@ -250,6 +253,9 @@ public class MenuInflater { */ private int itemShowAsAction; private int itemActionViewLayout; private String itemActionViewClassName; private String itemListenerMethodName; private static final int defaultGroupId = NO_ID; Loading Loading @@ -325,6 +331,8 @@ public class MenuInflater { itemEnabled = a.getBoolean(com.android.internal.R.styleable.MenuItem_enabled, groupEnabled); itemShowAsAction = a.getInt(com.android.internal.R.styleable.MenuItem_showAsAction, -1); itemListenerMethodName = a.getString(com.android.internal.R.styleable.MenuItem_onClick); itemActionViewLayout = a.getResourceId(com.android.internal.R.styleable.MenuItem_actionLayout, 0); itemActionViewClassName = a.getString(com.android.internal.R.styleable.MenuItem_actionViewClass); a.recycle(); Loading Loading @@ -368,6 +376,19 @@ public class MenuInflater { impl.setExclusiveCheckable(true); } } if (itemActionViewClassName != null) { try { final Class<?> clazz = Class.forName(itemActionViewClassName); Constructor<?> c = clazz.getConstructor(ACTION_VIEW_CONSTRUCTOR_SIGNATURE); item.setActionView((View) c.newInstance(mContext)); } catch (Exception e) { throw new InflateException(e); } } else if (itemActionViewLayout > 0) { final LayoutInflater inflater = LayoutInflater.from(mContext); item.setActionView(inflater.inflate(itemActionViewLayout, null)); } } public void addItem() { Loading
core/java/android/view/MenuItem.java +23 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,29 @@ public interface MenuItem { * {@link #SHOW_AS_ACTION_NEVER}. SHOW_AS_ACTION_NEVER is the default. * * @see android.app.ActionBar * @see #setActionView(View) */ public void setShowAsAction(int actionEnum); /** * Set an action view for this menu item. An action view will be displayed in place * of an automatically generated menu item element in the UI when this item is shown * as an action within a parent. * * @param view View to use for presenting this item to the user. * @return This Item so additional setters can be called. * * @see #setShowAsAction(int) */ public MenuItem setActionView(View view); /** * Returns the currently set action view for this menu item. * * @return This item's action view * * @see #setActionView(View) * @see #setShowAsAction(int) */ public View getActionView(); } No newline at end of file
core/java/com/android/internal/view/menu/ActionMenuItem.java +10 −1 Original line number Diff line number Diff line Loading @@ -19,9 +19,10 @@ package com.android.internal.view.menu; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.view.ContextMenu.ContextMenuInfo; import android.view.MenuItem; import android.view.SubMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.View; /** * @hide Loading Loading @@ -222,4 +223,12 @@ public class ActionMenuItem implements MenuItem { public void setShowAsAction(int show) { // Do nothing. ActionMenuItems always show as action buttons. } public MenuItem setActionView(View actionView) { throw new UnsupportedOperationException(); } public View getActionView() { return null; } }
core/java/com/android/internal/view/menu/ActionMenuView.java +8 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.LinearLayout; Loading Loading @@ -158,8 +159,13 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo for (int i = 0; i < itemCount; i++) { final MenuItemImpl itemData = itemsToShow.get(i); addItemView((ActionMenuItemView) itemData.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, this)); final View actionView = itemData.getActionView(); if (actionView != null) { addView(actionView); } else { addItemView((ActionMenuItemView) itemData.getItemView( MenuBuilder.TYPE_ACTION_BUTTON, this)); } } if (reserveOverflow) { Loading