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 /** Wrapper over HandheldUnusedAppsFragment */ 28 class HandheldUnusedAppsWrapperFragment : CollapsingToolbarBaseFragment() { 29 companion object { 30 /** Create a new instance of this fragment. */ 31 @JvmStatic newInstancenull32 fun newInstance(): HandheldUnusedAppsWrapperFragment { 33 return HandheldUnusedAppsWrapperFragment() 34 } 35 } 36 onCreateViewnull37 override fun onCreateView( 38 inflater: LayoutInflater, 39 container: ViewGroup?, 40 savedInstanceState: Bundle? 41 ): View? { 42 val view = super.onCreateView(inflater, container, savedInstanceState) 43 inflater.inflate(R.layout.settings_fragment_include, contentFrameLayout) 44 return view 45 } 46 onActivityCreatednull47 override fun onActivityCreated(savedInstanceState: Bundle?) { 48 super.onActivityCreated(savedInstanceState) 49 var preferenceFragment = 50 childFragmentManager.findFragmentById(R.id.preference_fragment_container) 51 as HandheldUnusedAppsFragment? 52 if (preferenceFragment == null) { 53 preferenceFragment = HandheldUnusedAppsFragment.newInstance() 54 preferenceFragment.arguments = arguments 55 childFragmentManager 56 .beginTransaction() 57 .add(R.id.preference_fragment_container, preferenceFragment) 58 .commit() 59 } 60 } 61 } 62