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