1 /* 2 * Copyright (C) 2015 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 17 package com.android.tv.menu; 18 19 import com.android.tv.menu.Menu.MenuShowReason; 20 import java.util.List; 21 22 /** An base interface for menu view. */ 23 public interface IMenuView { 24 /** Sets menu rows. */ setMenuRows(List<MenuRow> menuRows)25 void setMenuRows(List<MenuRow> menuRows); 26 27 /** 28 * Shows the main menu. 29 * 30 * <p>The inherited class should show the menu and select the row corresponding to {@code 31 * rowIdToSelect}. If the menu is already visible, change the current selection to the given 32 * row. 33 * 34 * @param reason A reason why this is called. See {@link MenuShowReason}. 35 * @param rowIdToSelect An ID of the row which corresponds to the {@code reason}. 36 */ onShow(@enuShowReason int reason, String rowIdToSelect, Runnable runnableAfterShow)37 void onShow(@MenuShowReason int reason, String rowIdToSelect, Runnable runnableAfterShow); 38 39 /** Hides the main menu */ onHide()40 void onHide(); 41 42 /** 43 * Updates the menu contents. 44 * 45 * <p>Returns <@code true> if the contents have been changed, otherwise {@code false}. 46 */ update(boolean menuActive)47 boolean update(boolean menuActive); 48 49 /** 50 * Updates the menu row. 51 * 52 * <p>Returns <@code true> if the contents have been changed, otherwise {@code false}. 53 */ update(String rowId, boolean menuActive)54 boolean update(String rowId, boolean menuActive); 55 56 /** Checks if the menu view is visible or not. */ isVisible()57 boolean isVisible(); 58 } 59