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