1 /*
2  * Copyright (C) 2019 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 import androidx.leanback.app.GuidedStepFragment;
23 import com.android.tv.R;
24 import com.android.tv.Starter;
25 
26 /** Activity to show details view in DVR. */
27 public class DvrRecordingSettingsActivity extends Activity {
28 
29     /**
30      * Name of the boolean flag to decide if the setting fragment should be translucent. Type:
31      * boolean
32      */
33     public static final String IS_WINDOW_TRANSLUCENT = "windows_translucent";
34     /**
35      * Name of the program added for recording.
36      */
37     public static final String PROGRAM = "program";
38 
39     @Override
onCreate(Bundle savedInstanceState)40     public void onCreate(Bundle savedInstanceState) {
41         Starter.start(this);
42         super.onCreate(savedInstanceState);
43         setContentView(R.layout.activity_dvr_series_settings);
44 
45         if (savedInstanceState == null) {
46             DvrRecordingSettingsFragment settingFragment = new DvrRecordingSettingsFragment();
47             settingFragment.setArguments(getIntent().getExtras());
48             GuidedStepFragment.addAsRoot(this, settingFragment, R.id.dvr_settings_view_frame);
49         }
50     }
51 
52     @Override
onAttachedToWindow()53     public void onAttachedToWindow() {
54         if (!getIntent().getExtras().getBoolean(IS_WINDOW_TRANSLUCENT, true)) {
55             getWindow()
56                     .setBackgroundDrawable(
57                             new ColorDrawable(getColor(R.color.common_tv_background)));
58         }
59     }
60 }
61