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