1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License 15 */ 16 17package android.support.v7.widget; 18 19import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 20 21import android.support.annotation.NonNull; 22import android.support.annotation.RestrictTo; 23import android.support.v7.view.menu.MenuBuilder; 24import android.view.MenuItem; 25 26/** 27 * An interface notified when a menu item is hovered. Useful for cases when hover should trigger 28 * some behavior at a higher level, like managing the opening and closing of submenus. 29 * 30 * @hide 31 */ 32@RestrictTo(LIBRARY_GROUP) 33public interface MenuItemHoverListener { 34 /** 35 * Called when hover exits a menu item. 36 * <p> 37 * If hover is moving to another item, this method will be called before 38 * {@link #onItemHoverEnter(MenuBuilder, MenuItem)} for the newly-hovered item. 39 * 40 * @param menu the item's parent menu 41 * @param item the hovered menu item 42 */ 43 void onItemHoverExit(@NonNull MenuBuilder menu, @NonNull MenuItem item); 44 45 /** 46 * Called when hover enters a menu item. 47 * 48 * @param menu the item's parent menu 49 * @param item the hovered menu item 50 */ 51 void onItemHoverEnter(@NonNull MenuBuilder menu, @NonNull MenuItem item); 52}