1/* This file is auto-generated from BackgroundFragment.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 */ 16package android.support.v17.leanback.app; 17 18import android.support.v4.app.Fragment; 19 20/** 21 * Fragment used by the background manager. 22 * @hide 23 */ 24public final class BackgroundSupportFragment extends Fragment implements 25 BackgroundManager.FragmentStateQueriable { 26 private BackgroundManager mBackgroundManager; 27 28 void setBackgroundManager(BackgroundManager backgroundManager) { 29 mBackgroundManager = backgroundManager; 30 } 31 32 BackgroundManager getBackgroundManager() { 33 return mBackgroundManager; 34 } 35 36 @Override 37 public void onStart() { 38 super.onStart(); 39 // mBackgroundManager might be null: 40 // if BackgroundSupportFragment is just restored by FragmentManager, 41 // and user does not call BackgroundManager.getInstance() yet. 42 if (mBackgroundManager != null) { 43 mBackgroundManager.onActivityStart(); 44 } 45 } 46 47 @Override 48 public void onResume() { 49 super.onResume(); 50 // mBackgroundManager might be null: 51 // if BackgroundSupportFragment is just restored by FragmentManager, 52 // and user does not call BackgroundManager.getInstance() yet. 53 if (mBackgroundManager != null) { 54 mBackgroundManager.onResume(); 55 } 56 } 57 58 @Override 59 public void onDestroy() { 60 super.onDestroy(); 61 // mBackgroundManager might be null: 62 // if BackgroundSupportFragment is just restored by FragmentManager, 63 // and user does not call BackgroundManager.getInstance() yet. 64 if (mBackgroundManager != null) { 65 mBackgroundManager.detach(); 66 } 67 } 68} 69