1 /* This file is auto-generated from BrowseFragmentTestActivity.java.  DO NOT MODIFY. */
2 
3 /*
4  * Copyright (C) 2015 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package android.support.v17.leanback.app;
19 
20 import android.support.v4.app.FragmentActivity;
21 import android.support.v4.app.FragmentTransaction;
22 
23 import android.content.Intent;
24 import android.os.Bundle;
25 import android.support.v17.leanback.tests.R;
26 
27 /**
28  * @hide from javadoc
29  */
30 public class BrowseSupportFragmentTestActivity extends FragmentActivity {
31 
32     public static final String EXTRA_ADD_TO_BACKSTACK = "addToBackStack";
33     public static final String EXTRA_NUM_ROWS = "numRows";
34     public static final String EXTRA_REPEAT_PER_ROW = "repeatPerRow";
35     public static final String EXTRA_LOAD_DATA_DELAY = "loadDataDelay";
36     public static final String EXTRA_TEST_ENTRANCE_TRANSITION = "testEntranceTransition";
37 
38     @Override
onCreate(Bundle savedInstanceState)39     public void onCreate(Bundle savedInstanceState) {
40         super.onCreate(savedInstanceState);
41         Intent intent = getIntent();
42 
43         BrowseTestSupportFragment.NUM_ROWS = intent.getIntExtra(EXTRA_NUM_ROWS,
44                 BrowseTestSupportFragment.DEFAULT_NUM_ROWS);
45         BrowseTestSupportFragment.REPEAT_PER_ROW = intent.getIntExtra(EXTRA_REPEAT_PER_ROW,
46                 BrowseTestSupportFragment.DEFAULT_REPEAT_PER_ROW);
47         BrowseTestSupportFragment.LOAD_DATA_DELAY = intent.getLongExtra(EXTRA_LOAD_DATA_DELAY,
48                 BrowseTestSupportFragment.DEFAULT_LOAD_DATA_DELAY);
49         BrowseTestSupportFragment.TEST_ENTRANCE_TRANSITION = intent.getBooleanExtra(
50                 EXTRA_TEST_ENTRANCE_TRANSITION,
51                 BrowseTestSupportFragment.DEFAULT_TEST_ENTRANCE_TRANSITION);
52         setContentView(R.layout.browse);
53         FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
54         ft.replace(R.id.main_frame, new BrowseTestSupportFragment());
55         if (intent.getBooleanExtra(EXTRA_ADD_TO_BACKSTACK, false)) {
56             ft.addToBackStack(null);
57         }
58         ft.commit();
59     }
60 
getBrowseTestSupportFragment()61     public BrowseTestSupportFragment getBrowseTestSupportFragment() {
62         return (BrowseTestSupportFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);
63     }
64 }
65