1 // CHECKSTYLE:OFF Generated code
2 /* This file is auto-generated from GuidedStepSupportFragmentTestActivity.java.  DO NOT MODIFY. */
3 
4 /*
5  * Copyright (C) 2016 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  */
17 
18 package androidx.leanback.app;
19 
20 import android.app.Activity;
21 import android.content.Intent;
22 import android.os.Bundle;
23 
24 public class GuidedStepFragmentTestActivity extends Activity {
25 
26     /**
27      * Frst Test that will be included in this Activity
28      */
29     public static final String EXTRA_TEST_NAME = "testName";
30     /**
31      * True(default) to addAsRoot() for first Test, false to use add()
32      */
33     public static final String EXTRA_ADD_AS_ROOT = "addAsRoot";
34 
35     /**
36      * Layout direction
37      */
38     public static final String EXTRA_LAYOUT_DIRECTION = "layoutDir";
39 
40     @Override
onCreate(Bundle savedInstanceState)41     protected void onCreate(Bundle savedInstanceState) {
42         super.onCreate(savedInstanceState);
43 
44         Intent intent = getIntent();
45 
46         int layoutDirection = intent.getIntExtra(EXTRA_LAYOUT_DIRECTION, -1);
47         if (layoutDirection != -1) {
48             findViewById(android.R.id.content).setLayoutDirection(layoutDirection);
49         }
50         if (savedInstanceState == null) {
51             String firstTestName = intent.getStringExtra(EXTRA_TEST_NAME);
52             if (firstTestName != null) {
53                 GuidedStepTestFragment testFragment = new GuidedStepTestFragment(firstTestName);
54                 if (intent.getBooleanExtra(EXTRA_ADD_AS_ROOT, true)) {
55                     GuidedStepTestFragment.addAsRoot(this, testFragment, android.R.id.content);
56                 } else {
57                     GuidedStepTestFragment.add(getFragmentManager(), testFragment,
58                             android.R.id.content);
59                 }
60             }
61         }
62     }
63 }
64