1 /** 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy 6 * 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, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 17 package com.android.settings.applications; 18 19 import android.app.Fragment; 20 import android.app.FragmentManager; 21 import android.app.FragmentTransaction; 22 import android.content.res.TypedArray; 23 import android.os.Bundle; 24 import android.preference.PreferenceFrameLayout; 25 import android.support.v13.app.FragmentPagerAdapter; 26 import android.support.v4.view.PagerTabStrip; 27 import android.support.v4.view.ViewPager; 28 import android.view.LayoutInflater; 29 import android.view.View; 30 import android.view.ViewGroup; 31 32 import com.android.internal.logging.MetricsProto.MetricsEvent; 33 import com.android.settings.InstrumentedFragment; 34 import com.android.settings.R; 35 36 public class BackgroundCheckSummary extends InstrumentedFragment { 37 // layout inflater object used to inflate views 38 private LayoutInflater mInflater; 39 40 @Override getMetricsCategory()41 protected int getMetricsCategory() { 42 return MetricsEvent.BACKGROUND_CHECK_SUMMARY; 43 } 44 45 @Override onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)46 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 47 // initialize the inflater 48 mInflater = inflater; 49 50 View rootView = mInflater.inflate(R.layout.background_check_summary, 51 container, false); 52 53 // We have to do this now because PreferenceFrameLayout looks at it 54 // only when the view is added. 55 if (container instanceof PreferenceFrameLayout) { 56 ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true; 57 } 58 59 FragmentTransaction ft = getChildFragmentManager().beginTransaction(); 60 ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE, 61 true), "appops"); 62 ft.commitAllowingStateLoss(); 63 64 return rootView; 65 } 66 } 67