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.Color;
21 import android.graphics.drawable.ColorDrawable;
22 import android.os.Bundle;
23 import android.support.v17.leanback.app.GuidedStepFragment;
24 
25 import com.android.tv.R;
26 import com.android.tv.TvApplication;
27 import com.android.tv.common.SoftPreconditions;
28 
29 /**
30  * Activity to show details view in DVR.
31  */
32 public class DvrSeriesSettingsActivity extends Activity {
33     /**
34      * Name of series id added to the Intent.
35      * Type: Long
36      */
37     public static final String SERIES_RECORDING_ID = "series_recording_id";
38     /**
39      * Name of the boolean flag to decide if the series recording with empty schedule and recording
40      * will be removed.
41      */
42     public static final String REMOVE_EMPTY_SERIES_RECORDING = "remove_empty_series_recording";
43     /**
44      * Name of the boolean flag to decide if the setting fragment should be translucent.
45      */
46     public static final String IS_WINDOW_TRANSLUCENT = "windows_translucent";
47     /**
48      * Name of the channel id list. If the channel list is given, we show the channels
49      * from the values in channel option.
50      * Type: Long array
51      */
52     public static final String CHANNEL_ID_LIST = "channel_id_list";
53 
54     /**
55      * Name of the boolean flag to check if the confirm dialog should show view schedule option.
56      */
57     public static final String SHOW_VIEW_SCHEDULE_OPTION_IN_DIALOG =
58             "show_view_schedule_option_in_dialog";
59 
60     @Override
onCreate(Bundle savedInstanceState)61     public void onCreate(Bundle savedInstanceState) {
62         TvApplication.setCurrentRunningProcess(this, true);
63         super.onCreate(savedInstanceState);
64         setContentView(R.layout.activity_dvr_series_settings);
65         long seriesRecordingId = getIntent().getLongExtra(SERIES_RECORDING_ID, -1);
66         SoftPreconditions.checkArgument(seriesRecordingId != -1);
67 
68         if (savedInstanceState == null) {
69             SeriesSettingsFragment settingFragment = new SeriesSettingsFragment();
70             settingFragment.setArguments(getIntent().getExtras());
71             GuidedStepFragment.addAsRoot(this, settingFragment, R.id.dvr_settings_view_frame);
72         }
73     }
74 
75     @Override
onAttachedToWindow()76     public void onAttachedToWindow() {
77         if (!getIntent().getExtras().getBoolean(IS_WINDOW_TRANSLUCENT, true)) {
78             getWindow().setBackgroundDrawable(
79                     new ColorDrawable(getColor(R.color.common_tv_background)));
80         }
81     }
82 }