From 6eaf45940e415ba66ed28b339d63bac9d8623718 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?=
- * An ActionProvider can be optionally specified for a {@link MenuItem} and in such a
- * case it will be responsible for creating the action view that appears in the
- * {@link android.app.ActionBar} as a substitute for the menu item when the item is
- * displayed as an action item. Also the provider is responsible for performing a
- * default action if a menu item placed on the overflow menu of the ActionBar is
- * selected and none of the menu item callbacks has handled the selection. For this
- * case the provider can also optionally provide a sub-menu for accomplishing the
- * task at hand.
- *
- * There are two ways for using an action provider for creating and handling of action views:
- *
- *
- *
- *
- *
- * <item android:id="@+id/my_menu_item"
- * android:title="Title"
- * android:icon="@drawable/my_menu_item_icon"
- * android:showAsAction="ifRoom"
- * android:actionProviderClass="foo.bar.SomeActionProvider" />
- *
- *
- * For the case of an action provider placed in a menu item not shown as an action this - * method is invoked if previous callbacks for processing menu selection has handled - * the event. - *
- *- * A menu item selection is processed in the following order: - *
- * The default implementation does not perform any action and returns false. - *
- */ - public boolean onPerformDefaultAction() { - return false; - } - - /** - * Determines if this ActionProvider has a submenu associated with it. - * - *Associated submenus will be shown when an action view is not. This - * provider instance will receive a call to {@link #onPrepareSubMenu(SubMenu)} - * after the call to {@link #onPerformDefaultAction()} and before a submenu is - * displayed to the user. - * - * @return true if the item backed by this provider should have an associated submenu - */ - public boolean hasSubMenu() { - return false; - } - - /** - * Called to prepare an associated submenu for the menu item backed by this ActionProvider. - * - *
if {@link #hasSubMenu()} returns true, this method will be called when the - * menu item is selected to prepare the submenu for presentation to the user. Apps - * may use this to create or alter submenu content right before display. - * - * @param subMenu Submenu that will be displayed - */ - public void onPrepareSubMenu(SubMenu subMenu) { - } - - /** - * Notify the system that the visibility of an action view's sub-UI such as - * an anchored popup has changed. This will affect how other system - * visibility notifications occur. - * - * @hide Pending future API approval - */ - public void subUiVisibilityChanged(boolean isVisible) { - if (mSubUiVisibilityListener != null) { - mSubUiVisibilityListener.onSubUiVisibilityChanged(isVisible); - } - } - - /** - * @hide Internal use only - */ - public void setSubUiVisibilityListener(SubUiVisibilityListener listener) { - mSubUiVisibilityListener = listener; - } - - /** - * @hide Internal use only - */ - public interface SubUiVisibilityListener { - public void onSubUiVisibilityChanged(boolean isVisible); - } -} -- cgit v1.2.3