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