[go: nahoru, domu]

1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18package android.support.v4.app;
19
20import android.os.Parcelable;
21
22import java.util.List;
23
24/**
25 * FragmentManagerNonConfig stores the retained instance fragments across
26 * activity recreation events.
27 *
28 * <p>Apps should treat objects of this type as opaque, returned by
29 * and passed to the state save and restore process for fragments in
30 * {@link FragmentController#retainNonConfig()} and
31 * {@link FragmentController#restoreAllState(Parcelable, FragmentManagerNonConfig)}.</p>
32 */
33public class FragmentManagerNonConfig {
34    private final List<Fragment> mFragments;
35    private final List<FragmentManagerNonConfig> mChildNonConfigs;
36
37    FragmentManagerNonConfig(List<Fragment> fragments,
38            List<FragmentManagerNonConfig> childNonConfigs) {
39        mFragments = fragments;
40        mChildNonConfigs = childNonConfigs;
41    }
42
43    /**
44     * @return the retained instance fragments returned by a FragmentManager
45     */
46    List<Fragment> getFragments() {
47        return mFragments;
48    }
49
50    /**
51     * @return the FragmentManagerNonConfigs from any applicable fragment's child FragmentManager
52     */
53    List<FragmentManagerNonConfig> getChildNonConfigs() {
54        return mChildNonConfigs;
55    }
56}
57