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