1 // CHECKSTYLE:OFF Generated code
2 /* This file is auto-generated from RowsActivity.java.  DO NOT MODIFY. */
3 
4 /*
5  * Copyright (C) 2014 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 package com.example.android.leanback;
18 
19 import android.content.Intent;
20 import android.os.Bundle;
21 import android.view.View;
22 
23 import androidx.fragment.app.FragmentActivity;
24 import androidx.leanback.widget.BrowseFrameLayout;
25 import androidx.leanback.widget.TitleHelper;
26 import androidx.leanback.widget.TitleView;
27 
28 public class RowsSupportActivity extends FragmentActivity
29 {
30     private RowsSupportFragment mRowsSupportFragment;
31 
32     /** Called when the activity is first created. */
33     @Override
onCreate(Bundle savedInstanceState)34     public void onCreate(Bundle savedInstanceState) {
35         super.onCreate(savedInstanceState);
36         setContentView(R.layout.rows_support);
37 
38         mRowsSupportFragment = (RowsSupportFragment) getSupportFragmentManager().findFragmentById(
39                 R.id.main_rows_fragment);
40 
41         setupTitleFragment();
42     }
43 
setupTitleFragment()44     private void setupTitleFragment() {
45         TitleView titleView = findViewById(R.id.title);
46         titleView.setTitle("RowsSupportFragment");
47         titleView.setOnSearchClickedListener(new View.OnClickListener() {
48             @Override
49             public void onClick(View view) {
50                 Intent intent = new Intent(RowsSupportActivity.this, SearchSupportActivity.class);
51                 startActivity(intent);
52             }
53         });
54 
55         BrowseFrameLayout frameLayout = findViewById(R.id.rows_frame);
56         TitleHelper titleHelper = new TitleHelper(frameLayout, titleView);
57         frameLayout.setOnFocusSearchListener(titleHelper.getOnFocusSearchListener());
58         mRowsSupportFragment.setTitleHelper(titleHelper);
59     }
60 }
61