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 {
25    private BackgroundManager mBackgroundManager;
26
27    void setBackgroundManager(BackgroundManager backgroundManager) {
28        mBackgroundManager = backgroundManager;
29    }
30
31    BackgroundManager getBackgroundManager() {
32        return mBackgroundManager;
33    }
34
35    @Override
36    public void onResume() {
37        super.onResume();
38        // mBackgroundManager might be null:
39        // if BackgroundSupportFragment is just restored by FragmentManager,
40        // and user does not call BackgroundManager.getInstance() yet.
41        if (mBackgroundManager != null) {
42            mBackgroundManager.onActivityResume();
43        }
44    }
45
46    @Override
47    public void onDestroy() {
48        super.onDestroy();
49        // mBackgroundManager might be null:
50        // if BackgroundSupportFragment is just restored by FragmentManager,
51        // and user does not call BackgroundManager.getInstance() yet.
52        if (mBackgroundManager != null) {
53            mBackgroundManager.detach();
54        }
55    }
56}
57