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 android.content.Context;
     20 
     21 import com.android.tv.R;
     22 import com.android.tv.TimeShiftManager;
     23 import com.android.tv.ui.TunableTvView;
     24 
     25 public class PlayControlsRow extends MenuRow {
     26     public static final String ID = PlayControlsRow.class.getName();
     27 
     28     private final TunableTvView mTvView;
     29     private final TimeShiftManager mTimeShiftManager;
     30 
     31     public PlayControlsRow(Context context, TunableTvView tvView, Menu menu,
     32             TimeShiftManager timeShiftManager) {
     33         super(context, menu, R.string.menu_title_play_controls, R.dimen.play_controls_height);
     34         mTvView = tvView;
     35         mTimeShiftManager = timeShiftManager;
     36     }
     37 
     38     @Override
     39     public void update() {
     40         ((PlayControlsRowView) getMenuRowView()).update();
     41     }
     42 
     43     @Override
     44     public int getLayoutResId() {
     45         return R.layout.play_controls;
     46     }
     47 
     48     /**
     49      * Returns TV view.
     50      */
     51     public TunableTvView getTvView() {
     52         return mTvView;
     53     }
     54 
     55     /**
     56      * Returns an instance of {@link TimeShiftManager}.
     57      */
     58     public TimeShiftManager getTimeShiftManager() {
     59         return mTimeShiftManager;
     60     }
     61 
     62     @Override
     63     public String getId() {
     64         return ID;
     65     }
     66 
     67     @Override
     68     public boolean isVisible() {
     69         return mTimeShiftManager.isAvailable();
     70     }
     71 
     72     @Override
     73     public boolean hideTitleWhenSelected() {
     74         return true;
     75     }
     76 }
     77