1 /* 2 * Copyright (C) 2010 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 package com.android.settings; 18 19 import android.app.settings.SettingsEnums; 20 import android.content.Context; 21 import android.os.Bundle; 22 23 import com.android.settings.dashboard.DashboardFragment; 24 import com.android.settings.display.BrightnessLevelPreferenceController; 25 import com.android.settings.display.CameraGesturePreferenceController; 26 import com.android.settings.display.LiftToWakePreferenceController; 27 import com.android.settings.display.ShowOperatorNamePreferenceController; 28 import com.android.settings.display.TapToWakePreferenceController; 29 import com.android.settings.display.ThemePreferenceController; 30 import com.android.settings.display.VrDisplayPreferenceController; 31 import com.android.settings.search.BaseSearchIndexProvider; 32 import com.android.settingslib.core.AbstractPreferenceController; 33 import com.android.settingslib.core.lifecycle.Lifecycle; 34 import com.android.settingslib.search.SearchIndexable; 35 36 import java.util.ArrayList; 37 import java.util.List; 38 39 @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) 40 public class DisplaySettings extends DashboardFragment { 41 private static final String TAG = "DisplaySettings"; 42 43 @Override getMetricsCategory()44 public int getMetricsCategory() { 45 return SettingsEnums.DISPLAY; 46 } 47 48 @Override getLogTag()49 protected String getLogTag() { 50 return TAG; 51 } 52 53 @Override getPreferenceScreenResId()54 protected int getPreferenceScreenResId() { 55 return R.xml.display_settings; 56 } 57 58 @Override onCreate(Bundle icicle)59 public void onCreate(Bundle icicle) { 60 super.onCreate(icicle); 61 } 62 63 @Override createPreferenceControllers(Context context)64 protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { 65 return buildPreferenceControllers(context, getSettingsLifecycle()); 66 } 67 68 @Override getHelpResource()69 public int getHelpResource() { 70 return R.string.help_uri_display; 71 } 72 buildPreferenceControllers( Context context, Lifecycle lifecycle)73 private static List<AbstractPreferenceController> buildPreferenceControllers( 74 Context context, Lifecycle lifecycle) { 75 final List<AbstractPreferenceController> controllers = new ArrayList<>(); 76 controllers.add(new CameraGesturePreferenceController(context)); 77 controllers.add(new LiftToWakePreferenceController(context)); 78 controllers.add(new TapToWakePreferenceController(context)); 79 controllers.add(new VrDisplayPreferenceController(context)); 80 controllers.add(new ShowOperatorNamePreferenceController(context)); 81 controllers.add(new ThemePreferenceController(context)); 82 controllers.add(new BrightnessLevelPreferenceController(context, lifecycle)); 83 return controllers; 84 } 85 86 public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = 87 new BaseSearchIndexProvider(R.xml.display_settings) { 88 89 @Override 90 public List<AbstractPreferenceController> createPreferenceControllers( 91 Context context) { 92 return buildPreferenceControllers(context, null); 93 } 94 }; 95 } 96