Search in sources :

Example 26 with AbstractPreferenceController

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

the class AmbientDisplaySettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle, AmbientDisplayConfiguration config, MetricsFeatureProvider metricsFeatureProvider, AmbientDisplayAlwaysOnPreferenceController.OnPreferenceChangedCallback aodCallback) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new AmbientDisplayNotificationsPreferenceController(context, config, metricsFeatureProvider));
    controllers.add(new AmbientDisplayAlwaysOnPreferenceController(context, config, aodCallback));
    controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle, config, MY_USER_ID, KEY_AMBIENT_DISPLAY_DOUBLE_TAP));
    controllers.add(new PickupGesturePreferenceController(context, lifecycle, config, MY_USER_ID, KEY_AMBIENT_DISPLAY_PICK_UP));
    controllers.add(new AmbientDisplayMusicController(context));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) DoubleTapScreenPreferenceController(com.android.settings.gestures.DoubleTapScreenPreferenceController) PickupGesturePreferenceController(com.android.settings.gestures.PickupGesturePreferenceController)

Example 27 with AbstractPreferenceController

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

the class PowerUsageSummary method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    mBatteryHeaderPreferenceController = new BatteryHeaderPreferenceController(context, getActivity(), this, /* host */
    getLifecycle());
    controllers.add(mBatteryHeaderPreferenceController);
    // controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    // controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new BatterySaverController(context, getLifecycle()));
    controllers.add(new BatteryPercentagePreferenceController(context));
    controllers.add(new BatteryImagePreferenceController(context));
    /*controllers.add(new AmbientDisplayPreferenceController(
                context,
                new AmbientDisplayConfiguration(context),
                KEY_AMBIENT_DISPLAY));*/
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) BatteryImagePreferenceController(com.android.settings.display.BatteryImagePreferenceController) BatteryPercentagePreferenceController(com.android.settings.display.BatteryPercentagePreferenceController)

Example 28 with AbstractPreferenceController

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

the class DatabaseIndexingUtils method getPreferenceControllerUriMap.

/**
 * @param className which wil provide the map between from {@link Uri}s to
 * {@link PreferenceControllerMixin}
 * @param context
 * @return A map between {@link Uri}s and {@link PreferenceControllerMixin}s to get the payload
 * types for Settings.
 */
public static Map<String, PreferenceControllerMixin> getPreferenceControllerUriMap(String className, Context context) {
    if (context == null) {
        return null;
    }
    final Class<?> clazz = getIndexableClass(className);
    if (clazz == null) {
        /*Log.d(TAG, "SearchIndexableResource '" + className +
                    "' should implement the " + Indexable.class.getName() + " interface!");*/
        return null;
    }
    // Will be non null only for a Local provider implementing a
    // SEARCH_INDEX_DATA_PROVIDER field
    final Indexable.SearchIndexProvider provider = getSearchIndexProvider(clazz);
    List<AbstractPreferenceController> controllers = provider.getPreferenceControllers(context);
    if (controllers == null) {
        return null;
    }
    ArrayMap<String, PreferenceControllerMixin> map = new ArrayMap<>();
    for (AbstractPreferenceController controller : controllers) {
        if (controller instanceof PreferenceControllerMixin) {
            map.put(controller.getPreferenceKey(), (PreferenceControllerMixin) controller);
        } else {
            throw new IllegalStateException(controller.getClass().getName() + " must implement " + PreferenceControllerMixin.class.getName());
        }
    }
    return map;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) PreferenceControllerMixin(com.android.settings.core.PreferenceControllerMixin) ArrayMap(android.util.ArrayMap)

Example 29 with AbstractPreferenceController

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

the class SystemDashboardFragment method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new SystemUpdatePreferenceController(context, UserManager.get(context)));
    controllers.add(new AdditionalSystemUpdatePreferenceController(context));
    controllers.add(new BackupSettingsActivityPreferenceController(context));
    controllers.add(new GesturesSettingPreferenceController(context));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) AdditionalSystemUpdatePreferenceController(com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController) AdditionalSystemUpdatePreferenceController(com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController) SystemUpdatePreferenceController(com.android.settings.deviceinfo.SystemUpdatePreferenceController) BackupSettingsActivityPreferenceController(com.android.settings.backup.BackupSettingsActivityPreferenceController) ArrayList(java.util.ArrayList) GesturesSettingPreferenceController(com.android.settings.gestures.GesturesSettingPreferenceController)

Example 30 with AbstractPreferenceController

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

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = new LockScreenNotificationPreferenceController(context, KEY_LOCK_SCREEN_NOTIFICATON, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
    lifecycle.addObserver(notificationController);
    controllers.add(notificationController);
    /*final AddUserWhenLockedPreferenceController addUserWhenLockedController =
            new AddUserWhenLockedPreferenceController(context);
        lifecycle.addObserver(addUserWhenLockedController);
        controllers.add(addUserWhenLockedController);*/
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController)

Aggregations

AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)344 ArrayList (java.util.ArrayList)245 Test (org.junit.Test)86 UserInfo (android.content.pm.UserInfo)33 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)33 Context (android.content.Context)31 SettingsActivity (com.android.settings.SettingsActivity)18 StorageManager (android.os.storage.StorageManager)16 StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)16 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)16 AdditionalSystemUpdatePreferenceController (com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController)12 Activity (android.app.Activity)11 BasePreferenceController (com.android.settings.core.BasePreferenceController)11 PreferenceScreen (android.support.v7.preference.PreferenceScreen)10 UserManager (android.os.UserManager)9 PreferenceControllerMixin (com.android.settings.core.PreferenceControllerMixin)9 TimeoutPreferenceController (com.android.settings.display.TimeoutPreferenceController)9 Intent (android.content.Intent)8 AmbientDisplayConfiguration (com.android.internal.hardware.AmbientDisplayConfiguration)8 PreferenceScreen (androidx.preference.PreferenceScreen)7