MenuItemHoverListener.java revision 8375d639986529969ea5e118de548d29db16ec97
1package android.widget;
2
3import com.android.internal.view.menu.MenuBuilder;
4
5import android.annotation.NonNull;
6
7/**
8 * An interface notified when a menu item is hovered. Useful for cases when hover should trigger
9 * some behavior at a higher level, like managing the opening and closing of submenus.
10 *
11 * @hide
12 */
13public interface MenuItemHoverListener {
14    /**
15     * Called when hover exits a menu item.
16     * <p>
17     * If hover is moving to another item, this method will be called before
18     * {@link #onItemHoverEnter(MenuBuilder, int)} for the newly-hovered item.
19     *
20     * @param menu the item's parent menu
21     * @param position the position of the item within the menu
22     */
23    void onItemHoverExit(@NonNull MenuBuilder menu, int position);
24
25    /**
26     * Called when hover enters a menu item.
27     *
28     * @param menu the item's parent menu
29     * @param position the position of the item within the menu
30     */
31    void onItemHoverEnter(@NonNull MenuBuilder menu, int position);
32}
33