107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko/* 207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Copyright (C) 2015 The Android Open Source Project 307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Licensed under the Apache License, Version 2.0 (the "License"); 507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * you may not use this file except in compliance with the License. 607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * You may obtain a copy of the License at 707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 807b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * http://www.apache.org/licenses/LICENSE-2.0 907b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 1007b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Unless required by applicable law or agreed to in writing, software 1107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * distributed under the License is distributed on an "AS IS" BASIS, 1207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * See the License for the specific language governing permissions and 1407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * limitations under the License. 1507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 1607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 1707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalkopackage com.android.tv.menu; 1807b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 1907b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalkoimport com.android.tv.menu.Menu.MenuShowReason; 2007b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 2107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalkoimport java.util.List; 2207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 2307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko/** 2407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * An base interface for menu view. 2507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 2607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalkopublic interface IMenuView { 2707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko /** 2807b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Sets menu rows. 2907b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 3007b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko void setMenuRows(List<MenuRow> menuRows); 3107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 3207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko /** 3307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Shows the main menu. 3407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 3507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * <p> The inherited class should show the menu and select the row corresponding to 3607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * {@code rowIdToSelect}. If the menu is already visible, change the current selection to the 3707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * given row. 3807b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 3907b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * @param reason A reason why this is called. See {@link MenuShowReason}. 4007b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * @param rowIdToSelect An ID of the row which corresponds to the {@code reason}. 4107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 4207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko void onShow(@MenuShowReason int reason, String rowIdToSelect, Runnable runnableAfterShow); 4307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 4407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko /** 4507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Hides the main menu 4607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 4707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko void onHide(); 4807b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 4907b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko /** 5007b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Updates the menu contents. 5107b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * 5207b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * <p>Returns <@code true> if the contents have been changed, otherwise {@code false}. 5307b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 5407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko boolean update(boolean menuActive); 5507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko 5607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko /** 5765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * Updates the menu row. 5865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * 5965fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * <p>Returns <@code true> if the contents have been changed, otherwise {@code false}. 6065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko */ 6165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko boolean update(String rowId, boolean menuActive); 6265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko 6365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko /** 6407b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko * Checks if the menu view is visible or not. 6507b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko */ 6607b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko boolean isVisible(); 6707b043dc3db83d6d20f0e8513b946830ab00e37bNick Chalko} 68