Search in sources :

Example 1 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DashboardFragment method onPreferenceTreeClick.

@Override
public boolean onPreferenceTreeClick(Preference preference) {
    Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
    // If preference contains intent, log it before handling.
    mMetricsFeatureProvider.logDashboardStartIntent(getContext(), preference.getIntent(), getMetricsCategory());
    // Give all controllers a chance to handle click.
    for (AbstractPreferenceController controller : controllers) {
        if (controller.handlePreferenceTreeClick(preference)) {
            return true;
        }
    }
    return super.onPreferenceTreeClick(preference);
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController)

Example 2 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DashboardFragment method displayResourceTiles.

/**
 * Displays resource based tiles.
 */
private void displayResourceTiles() {
    final int resId = getPreferenceScreenResId();
    if (resId <= 0) {
        return;
    }
    addPreferencesFromResource(resId);
    final PreferenceScreen screen = getPreferenceScreen();
    Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
    for (AbstractPreferenceController controller : controllers) {
        controller.displayPreference(screen);
    }
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController)

Example 3 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DeviceInfoSettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Activity activity, Fragment fragment, Lifecycle lifecycle) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
    controllers.add(new AdditionalSystemUpdatePreferenceController(context));
    controllers.add(new ManualPreferenceController(context));
    controllers.add(new FeedbackPreferenceController(fragment, context));
    controllers.add(new KernelVersionPreferenceController(context));
    controllers.add(new BasebandVersionPreferenceController(context));
    controllers.add(new FirmwareVersionPreferenceController(context, lifecycle));
    controllers.add(new RegulatoryInfoPreferenceController(context));
    controllers.add(new DeviceModelPreferenceController(context, fragment));
    controllers.add(new SecurityPatchPreferenceController(context));
    controllers.add(new FccEquipmentIdPreferenceController(context));
    controllers.add(new SELinuxStatusPreferenceController(context));
    controllers.add(new SafetyInfoPreferenceController(context));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) ManualPreferenceController(com.android.settings.deviceinfo.ManualPreferenceController) SecurityPatchPreferenceController(com.android.settings.deviceinfo.SecurityPatchPreferenceController) BasebandVersionPreferenceController(com.android.settings.deviceinfo.BasebandVersionPreferenceController) AdditionalSystemUpdatePreferenceController(com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController) KernelVersionPreferenceController(com.android.settings.deviceinfo.KernelVersionPreferenceController) FccEquipmentIdPreferenceController(com.android.settings.deviceinfo.FccEquipmentIdPreferenceController) BuildNumberPreferenceController(com.android.settings.deviceinfo.BuildNumberPreferenceController) FeedbackPreferenceController(com.android.settings.deviceinfo.FeedbackPreferenceController) FirmwareVersionPreferenceController(com.android.settings.deviceinfo.FirmwareVersionPreferenceController) RegulatoryInfoPreferenceController(com.android.settings.deviceinfo.RegulatoryInfoPreferenceController) SafetyInfoPreferenceController(com.android.settings.deviceinfo.SafetyInfoPreferenceController) SELinuxStatusPreferenceController(com.android.settings.deviceinfo.SELinuxStatusPreferenceController) DeviceModelPreferenceController(com.android.settings.deviceinfo.DeviceModelPreferenceController)

Example 4 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DisplaySettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    // controllers.add(new AutoRotatePreferenceController(context, lifecycle));
    controllers.add(new CameraGesturePreferenceController(context));
    controllers.add(new FontSizePreferenceController(context));
    controllers.add(new LiftToWakePreferenceController(context));
    controllers.add(new NightDisplayPreferenceController(context));
    controllers.add(new NightModePreferenceController(context));
    controllers.add(new ScreenSaverPreferenceController(context));
    controllers.add(new AmbientDisplayPreferenceController(context, new AmbientDisplayConfiguration(context), KEY_AMBIENT_DISPLAY));
    controllers.add(new TapToWakePreferenceController(context));
    controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new VrDisplayPreferenceController(context));
    controllers.add(new WallpaperPreferenceController(context));
    // controllers.add(new ThemePreferenceController(context));
    controllers.add(new BrightnessLevelPreferenceController(context, lifecycle));
    controllers.add(new ColorModePreferenceController(context));
    return controllers;
}
Also used : ScreenSaverPreferenceController(com.android.settings.display.ScreenSaverPreferenceController) AutoBrightnessPreferenceController(com.android.settings.display.AutoBrightnessPreferenceController) BrightnessLevelPreferenceController(com.android.settings.display.BrightnessLevelPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) VrDisplayPreferenceController(com.android.settings.display.VrDisplayPreferenceController) ArrayList(java.util.ArrayList) CameraGesturePreferenceController(com.android.settings.display.CameraGesturePreferenceController) TimeoutPreferenceController(com.android.settings.display.TimeoutPreferenceController) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration) TapToWakePreferenceController(com.android.settings.display.TapToWakePreferenceController) AmbientDisplayPreferenceController(com.android.settings.display.AmbientDisplayPreferenceController) LiftToWakePreferenceController(com.android.settings.display.LiftToWakePreferenceController) NightModePreferenceController(com.android.settings.display.NightModePreferenceController) ColorModePreferenceController(com.android.settings.display.ColorModePreferenceController) FontSizePreferenceController(com.android.settings.display.FontSizePreferenceController) WallpaperPreferenceController(com.android.settings.display.WallpaperPreferenceController) NightDisplayPreferenceController(com.android.settings.display.NightDisplayPreferenceController)

Example 5 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class ConfigureWifiSettings method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final NetworkScoreManagerWrapper networkScoreManagerWrapper = new NetworkScoreManagerWrapper(context.getSystemService(NetworkScoreManager.class));
    mWifiWakeupPreferenceController = new WifiWakeupPreferenceController(context, getLifecycle());
    mUseOpenWifiPreferenceController = new UseOpenWifiPreferenceController(context, this, networkScoreManagerWrapper, getLifecycle());
    final WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(mWifiWakeupPreferenceController);
    controllers.add(new NetworkScorerPickerPreferenceController(context, networkScoreManagerWrapper));
    controllers.add(new NotifyOpenNetworksPreferenceController(context, getLifecycle()));
    controllers.add(mUseOpenWifiPreferenceController);
    controllers.add(new WifiInfoPreferenceController(context, getLifecycle(), wifiManager));
    controllers.add(new CellularFallbackPreferenceController(context));
    controllers.add(new WifiP2pPreferenceController(context, getLifecycle(), wifiManager));
    controllers.add(new WifiCallingPreferenceController(context));
    controllers.add(new WpsPreferenceController(context, getLifecycle(), wifiManager, getFragmentManager()));
    return controllers;
}
Also used : WifiManager(android.net.wifi.WifiManager) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) NetworkScorerPickerPreferenceController(com.android.settings.network.NetworkScorerPickerPreferenceController) WifiP2pPreferenceController(com.android.settings.wifi.p2p.WifiP2pPreferenceController) ArrayList(java.util.ArrayList) WifiCallingPreferenceController(com.android.settings.network.WifiCallingPreferenceController) NetworkScoreManager(android.net.NetworkScoreManager) NetworkScoreManagerWrapper(com.android.settings.network.NetworkScoreManagerWrapper)

Aggregations

AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)298 ArrayList (java.util.ArrayList)211 Test (org.junit.Test)75 Context (android.content.Context)29 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)29 UserInfo (android.content.pm.UserInfo)28 SettingsActivity (com.android.settings.SettingsActivity)15 StorageManager (android.os.storage.StorageManager)14 StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)14 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)14 PreferenceScreen (android.support.v7.preference.PreferenceScreen)12 AdditionalSystemUpdatePreferenceController (com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController)12 TimeoutPreferenceController (com.android.settings.display.TimeoutPreferenceController)10 Activity (android.app.Activity)9 AmbientDisplayConfiguration (com.android.internal.hardware.AmbientDisplayConfiguration)9 AmbientDisplayPreferenceController (com.android.settings.display.AmbientDisplayPreferenceController)9 AutoBrightnessPreferenceController (com.android.settings.display.AutoBrightnessPreferenceController)9 Config (org.robolectric.annotation.Config)7 Bundle (android.os.Bundle)6 SecondaryUserController (com.android.settings.deviceinfo.storage.SecondaryUserController)6