1 /* This file is auto-generated from RowsActivity.java. DO NOT MODIFY. */ 2 3 /* 4 * Copyright (C) 2014 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 7 * in compliance with the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software distributed under the License 12 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 13 * or implied. See the License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 package com.example.android.leanback; 17 18 import android.support.v4.app.FragmentActivity; 19 import android.content.Intent; 20 import android.os.Bundle; 21 import android.support.v17.leanback.R; 22 import android.support.v17.leanback.widget.BrowseFrameLayout; 23 import android.support.v17.leanback.widget.TitleHelper; 24 import android.support.v17.leanback.widget.TitleView; 25 import android.view.View; 26 27 public class RowsSupportActivity extends FragmentActivity 28 { 29 private RowsSupportFragment mRowsSupportFragment; 30 private TitleHelper mTitleHelper; 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 = (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 = (BrowseFrameLayout) findViewById(R.id.rows_frame); 56 mTitleHelper = new TitleHelper(frameLayout, titleView); 57 frameLayout.setOnFocusSearchListener(mTitleHelper.getOnFocusSearchListener()); 58 mRowsSupportFragment.setTitleHelper(mTitleHelper); 59 } 60 } 61