• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 @file:Suppress("DEPRECATION")
17 
18 package com.android.permissioncontroller.permission.ui.handheld
19 
20 import android.os.Bundle
21 import android.view.LayoutInflater
22 import android.view.View
23 import android.view.ViewGroup
24 import com.android.permissioncontroller.R
25 import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseFragment
26 
27 /**
28  * Wrapper over HandheldUnusedAppsFragment
29  */
30 class HandheldUnusedAppsWrapperFragment : CollapsingToolbarBaseFragment() {
31     companion object {
32         /** Create a new instance of this fragment.  */
33         @JvmStatic
newInstancenull34         fun newInstance(): HandheldUnusedAppsWrapperFragment {
35             return HandheldUnusedAppsWrapperFragment()
36         }
37     }
38 
onCreateViewnull39     override fun onCreateView(
40         inflater: LayoutInflater,
41         container: ViewGroup?,
42         savedInstanceState: Bundle?
43     ): View? {
44         val view = super.onCreateView(inflater, container, savedInstanceState)
45         inflater.inflate(R.layout.settings_fragment_include, contentFrameLayout)
46         return view
47     }
48 
onActivityCreatednull49     override fun onActivityCreated(savedInstanceState: Bundle?) {
50         super.onActivityCreated(savedInstanceState)
51         var preferenceFragment = childFragmentManager
52                 .findFragmentById(R.id.preference_fragment_container)
53                 as HandheldUnusedAppsFragment?
54         if (preferenceFragment == null) {
55             preferenceFragment = HandheldUnusedAppsFragment.newInstance()
56             preferenceFragment.arguments = arguments
57             childFragmentManager.beginTransaction()
58                     .add(R.id.preference_fragment_container, preferenceFragment)
59                     .commit()
60         }
61     }
62 }
63