[go: nahoru, domu]

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