Search in sources :

Example 11 with Lifecycle

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

the class BluetoothSettings method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context, lifecycle);
    mPairingPrefController = new BluetoothPairingPreferenceController(context, this, (SettingsActivity) getActivity());
    controllers.add(mDeviceNamePrefController);
    controllers.add(mPairingPrefController);
    controllers.add(new BluetoothFilesPreferenceController(context));
    controllers.add(new BluetoothDeviceRenamePreferenceController(context, this, lifecycle));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) SettingsActivity(com.android.settings.SettingsActivity)

Example 12 with Lifecycle

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

the class ConnectedDeviceDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final NfcPreferenceController nfcPreferenceController = new NfcPreferenceController(context);
    lifecycle.addObserver(nfcPreferenceController);
    controllers.add(nfcPreferenceController);
    mUsbPrefController = new UsbModePreferenceController(context, new UsbBackend(context));
    lifecycle.addObserver(mUsbPrefController);
    controllers.add(mUsbPrefController);
    final BluetoothMasterSwitchPreferenceController bluetoothPreferenceController = new BluetoothMasterSwitchPreferenceController(context, Utils.getLocalBtManager(context), this, (SettingsActivity) getActivity());
    lifecycle.addObserver(bluetoothPreferenceController);
    controllers.add(bluetoothPreferenceController);
    SmsMirroringFeatureProvider smsMirroringFeatureProvider = FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
    AbstractPreferenceController smsMirroringController = smsMirroringFeatureProvider.getController(context);
    controllers.add(smsMirroringController);
    return controllers;
}
Also used : BluetoothMasterSwitchPreferenceController(com.android.settings.bluetooth.BluetoothMasterSwitchPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) NfcPreferenceController(com.android.settings.nfc.NfcPreferenceController) UsbBackend(com.android.settings.deviceinfo.UsbBackend)

Example 13 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle 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)

Example 14 with Lifecycle

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

the class ManageApplicationsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
    ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mState);
    when(mState.newSession(any())).thenReturn(mSession);
    mBgLooper = Looper.myLooper();
    when(mState.getBackgroundLooper()).thenReturn(mBgLooper);
    mFragment = new ManageApplications();
    ReflectionHelpers.setField(mFragment, "mLifecycle", new Lifecycle());
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Before(org.junit.Before)

Example 15 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by crdroidandroid.

the class MobileNetworkPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Aggregations

Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)259 Before (org.junit.Before)218 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)33 ArrayList (java.util.ArrayList)32 PreferenceManager (androidx.preference.PreferenceManager)16 Preference (androidx.preference.Preference)15 TextView (android.widget.TextView)11 SettingsActivity (com.android.settings.SettingsActivity)10 Handler (android.os.Handler)9 LinkProperties (android.net.LinkProperties)8 Network (android.net.Network)8 NetworkRequest (android.net.NetworkRequest)8 LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)8 BluetoothManager (android.bluetooth.BluetoothManager)7 Intent (android.content.Intent)7 PreferenceCategory (androidx.preference.PreferenceCategory)7 SwitchBar (com.android.settings.widget.SwitchBar)7 BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)6 Bundle (android.os.Bundle)6 RecyclerView (android.support.v7.widget.RecyclerView)6