Home | History | Annotate | Download | only in menu
      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 package android.car.app.menu;
     17 
     18 import android.os.Bundle;
     19 
     20 /**
     21  * Stores the root id for the menu. The RootMenu is the main menu.
     22  * Also allows passing hints through bundles. Hints allow the
     23  * the recipient to alter its behavior based on the hints.
     24  */
     25 public class RootMenu {
     26     private final Bundle mBundle;
     27     private final String mRootId;
     28 
     29     /**
     30      * Create a root with no extra hints.
     31      *
     32      * @param id Root id
     33      */
     34     public RootMenu(String id) {
     35         this(id, null);
     36     }
     37 
     38     /**
     39      * Create a root with hints
     40      *
     41      * @param id Root id
     42      * @param extras Hints to pass along
     43      */
     44     public RootMenu(String id, Bundle extras) {
     45         mRootId = id;
     46         mBundle = extras;
     47     }
     48 
     49     /**
     50      * Get the root id
     51      *
     52      * @return The root id
     53      */
     54     public String getId() {
     55         return mRootId;
     56     }
     57 
     58     /**
     59      * Get any hints
     60      *
     61      * @return A bundle if there are hints; null otherwise.
     62      */
     63     public Bundle getBundle() {
     64         return new Bundle(mBundle);
     65     }
     66 }
     67