• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.tv.dvr.ui;
18 
19 import android.app.Activity;
20 import android.graphics.drawable.ColorDrawable;
21 import android.os.Bundle;
22 
23 import androidx.leanback.app.GuidedStepFragment;
24 
25 import com.android.tv.R;
26 import com.android.tv.Starter;
27 import com.android.tv.common.SoftPreconditions;
28 import com.android.tv.data.ProgramImpl;
29 
30 /** Activity to show details view in DVR. */
31 public class DvrSeriesSettingsActivity extends Activity {
32     /** Name of series id added to the Intent. Type: Long */
33     public static final String SERIES_RECORDING_ID = "series_recording_id";
34     /**
35      * Name of the boolean flag to decide if the series recording with empty schedule and recording
36      * will be removed. Type: boolean
37      */
38     public static final String REMOVE_EMPTY_SERIES_RECORDING = "remove_empty_series_recording";
39     /**
40      * Name of the boolean flag to decide if the setting fragment should be translucent. Type:
41      * boolean
42      */
43     public static final String IS_WINDOW_TRANSLUCENT = "windows_translucent";
44     /**
45      * Name of the program list. The list contains the programs which belong to the series. Type:
46      * List<{@link ProgramImpl}>
47      */
48     public static final String PROGRAM_LIST = "program_list";
49 
50     /**
51      * Name of the boolean flag to check if the confirm dialog should show view schedule option.
52      * Type: boolean
53      */
54     public static final String SHOW_VIEW_SCHEDULE_OPTION_IN_DIALOG =
55             "show_view_schedule_option_in_dialog";
56 
57     /**
58      * Name of the current program added to series. The current program will be recorded only when
59      * the series recording is initialized from media controller. But for other case, the current
60      * program won't be recorded.
61      */
62     public static final String CURRENT_PROGRAM = "current_program";
63 
64     @Override
onCreate(Bundle savedInstanceState)65     public void onCreate(Bundle savedInstanceState) {
66         Starter.start(this);
67         super.onCreate(savedInstanceState);
68         setContentView(R.layout.activity_dvr_series_settings);
69         long seriesRecordingId = getIntent().getLongExtra(SERIES_RECORDING_ID, -1);
70         SoftPreconditions.checkArgument(seriesRecordingId != -1);
71 
72         if (savedInstanceState == null) {
73             DvrSeriesSettingsFragment settingFragment = new DvrSeriesSettingsFragment();
74             settingFragment.setArguments(getIntent().getExtras());
75             GuidedStepFragment.addAsRoot(this, settingFragment, R.id.dvr_settings_view_frame);
76         }
77     }
78 
79     @Override
onAttachedToWindow()80     public void onAttachedToWindow() {
81         if (!getIntent().getExtras().getBoolean(IS_WINDOW_TRANSLUCENT, true)) {
82             getWindow()
83                     .setBackgroundDrawable(
84                             new ColorDrawable(getColor(R.color.common_tv_background)));
85         }
86     }
87 }
88