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