BrowseSupportFragmentTestActivity.java revision f89c67eeac3938f245c858774cc7c9f87fb7487d
1// CHECKSTYLE:OFF Generated code
2/* This file is auto-generated from BrowseFragmentTestActivity.java.  DO NOT MODIFY. */
3
4/*
5 * Copyright (C) 2015 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package android.support.v17.leanback.app;
20
21import android.support.v4.app.FragmentActivity;
22import android.support.v4.app.FragmentTransaction;
23import android.content.Intent;
24import android.os.Bundle;
25import android.support.v17.leanback.test.R;
26
27public class BrowseSupportFragmentTestActivity extends FragmentActivity {
28
29    public static final String EXTRA_ADD_TO_BACKSTACK = "addToBackStack";
30    public static final String EXTRA_NUM_ROWS = "numRows";
31    public static final String EXTRA_REPEAT_PER_ROW = "repeatPerRow";
32    public static final String EXTRA_LOAD_DATA_DELAY = "loadDataDelay";
33    public static final String EXTRA_TEST_ENTRANCE_TRANSITION = "testEntranceTransition";
34    public static final String EXTRA_SET_ADAPTER_AFTER_DATA_LOAD = "set_adapter_after_data_load";
35    public static final String EXTRA_HEADERS_STATE = "headers_state";
36
37    @Override
38    public void onCreate(Bundle savedInstanceState) {
39        super.onCreate(savedInstanceState);
40        Intent intent = getIntent();
41
42        setContentView(R.layout.browse);
43        if (savedInstanceState == null) {
44            Bundle arguments = new Bundle();
45            arguments.putAll(intent.getExtras());
46            BrowseTestSupportFragment fragment = new BrowseTestSupportFragment();
47            fragment.setArguments(arguments);
48            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
49            ft.replace(R.id.main_frame, fragment);
50            if (intent.getBooleanExtra(EXTRA_ADD_TO_BACKSTACK, false)) {
51                ft.addToBackStack(null);
52            }
53            ft.commit();
54        }
55    }
56
57    public BrowseTestSupportFragment getBrowseTestSupportFragment() {
58        return (BrowseTestSupportFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);
59    }
60}
61