Search in sources :

Example 66 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class HapticFeedbackIntensityPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mContext = RuntimeEnvironment.application;
    mController = new HapticFeedbackIntensityPreferenceController(mContext);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 67 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationVibrationIntensityPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mContext = spy(RuntimeEnvironment.application);
    mResources = spy(mContext.getResources());
    when(mContext.getResources()).thenReturn(mResources);
    when(mResources.getBoolean(R.bool.config_vibration_supports_multiple_intensities)).thenReturn(true);
    mController = new NotificationVibrationIntensityPreferenceController(mContext) {

        @Override
        protected int getDefaultIntensity() {
            return 10;
        }
    };
    mLifecycle.addObserver(mController);
    mPreference = new Preference(mContext);
    mPreference.setSummary("Test");
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
Also used : Preference(androidx.preference.Preference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 68 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AccountHeaderPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    FakeFeatureFactory.setupForTest();
    mHeaderPreference = new LayoutPreference(RuntimeEnvironment.application, R.layout.settings_entity_header);
    doReturn(RuntimeEnvironment.application).when(mActivity).getApplicationContext();
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 69 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DevelopmentSwitchBarControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    final Context context = RuntimeEnvironment.application;
    ShadowUserManager.getShadow().setIsAdminUser(true);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mSwitchBar = new SwitchBar(context);
    when(mSettings.getContext()).thenReturn(context);
}
Also used : Context(android.content.Context) SwitchBar(com.android.settings.widget.SwitchBar) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 70 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BluetoothAudioBitsPerSamplePreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = spy(new BluetoothAudioBitsPerSamplePreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore));
    mListValues = mController.getListValues();
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
}
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