1 // CHECKSTYLE:OFF Generated code 2 /* This file is auto-generated from DetailsActivity.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.support.v4.app.FragmentActivity; 20 import android.os.Bundle; 21 22 public class DetailsSupportActivity extends FragmentActivity 23 { 24 public static final String EXTRA_ITEM = "item"; 25 public static final String SHARED_ELEMENT_NAME = "hero"; 26 useLegacyFragment()27 private boolean useLegacyFragment() { 28 return (DetailsPresenterSelectionActivity.USE_LEGACY_PRESENTER 29 && !(this instanceof SearchDetailsSupportActivity)); 30 } 31 hasBackgroundVideo()32 protected boolean hasBackgroundVideo() { 33 return false; 34 } 35 36 /** Called when the activity is first created. */ 37 @Override onCreate(Bundle savedInstanceState)38 public void onCreate(Bundle savedInstanceState) 39 { 40 super.onCreate(savedInstanceState); 41 getSupportFragmentManager().enableDebugLogging(true); 42 setContentView(R.layout.details_activity); 43 if (savedInstanceState == null) { 44 if (useLegacyFragment()) { 45 DetailsSupportFragment fragment = new DetailsSupportFragment(); 46 fragment.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM)); 47 getSupportFragmentManager().beginTransaction() 48 .replace(R.id.details_fragment, fragment) 49 .commit(); 50 } else { 51 NewDetailsSupportFragment fragment = new NewDetailsSupportFragment(); 52 fragment.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM)); 53 fragment.setBackgroundVideo(hasBackgroundVideo()); 54 getSupportFragmentManager().beginTransaction() 55 .replace(R.id.details_fragment, fragment) 56 .commit(); 57 } 58 } else { 59 if (useLegacyFragment()) { 60 DetailsSupportFragment fragment = (DetailsSupportFragment) getSupportFragmentManager() 61 .findFragmentById(R.id.details_fragment); 62 fragment.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM)); 63 } else { 64 NewDetailsSupportFragment fragment = (NewDetailsSupportFragment) getSupportFragmentManager() 65 .findFragmentById(R.id.details_fragment); 66 fragment.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM)); 67 } 68 } 69 } 70 } 71