Search in sources :

Example 76 with Lifecycle

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

the class DisabledSubscriptionControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    LifecycleOwner lifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(lifecycleOwner);
    doReturn(mSubscriptionManager).when(mContext).getSystemService(SubscriptionManager.class);
    mCategory = new PreferenceCategory(mContext);
    doReturn(mCategory).when(mScreen).findPreference(KEY);
    mController = new DisabledSubscriptionController(mContext, KEY);
    mController.init(mLifecycle, SUB_ID);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) LifecycleOwner(androidx.lifecycle.LifecycleOwner) Before(org.junit.Before)

Example 77 with Lifecycle

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

the class AirplaneModePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    FakeFeatureFactory.setupForTest();
    mContext = spy(RuntimeEnvironment.application);
    mResolver = RuntimeEnvironment.application.getContentResolver();
    doReturn(mPackageManager).when(mContext).getPackageManager();
    mController = new AirplaneModePreferenceController(mContext, SettingsSlicesContract.KEY_AIRPLANE_MODE);
    mPreferenceManager = new PreferenceManager(mContext);
    mScreen = mPreferenceManager.createPreferenceScreen(mContext);
    mPreference = new RestrictedSwitchPreference(mContext);
    mPreference.setKey(SettingsSlicesContract.KEY_AIRPLANE_MODE);
    mScreen.addPreference(mPreference);
    mController.setFragment(null);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mLifecycle.addObserver(mController);
}
Also used : RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 78 with Lifecycle

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

the class RestrictedEncryptionPreferenceControllerTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mInstallCredentialsPreferenceController = new InstallCredentialsPreferenceController(mContext);
    mResetCredentialsPreferenceController = new ResetCredentialsPreferenceController(mContext, mLifecycle);
    mUserCredentialsPreferenceController = new UserCredentialsPreferenceController(mContext);
    mUserManager = ShadowUserManager.getShadow();
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 79 with Lifecycle

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

the class TrustAgentListPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mActivity = Robolectric.buildActivity(Activity.class).get();
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mFeatureFactory = FakeFeatureFactory.setupForTest();
    when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(any(Context.class))).thenReturn(mLockPatternUtils);
    when(mFeatureFactory.securityFeatureProvider.getTrustAgentManager()).thenReturn(mTrustAgentManager);
    when(mCategory.getKey()).thenReturn(PREF_KEY_SECURITY_CATEGORY);
    when(mCategory.getContext()).thenReturn(mActivity);
    when(mScreen.findPreference(PREF_KEY_SECURITY_CATEGORY)).thenReturn(mCategory);
    mController = new TrustAgentListPreferenceController(mActivity, mFragment, mLifecycle);
}
Also used : Context(android.content.Context) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 80 with Lifecycle

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

the class AssistContextPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mContext = RuntimeEnvironment.application;
    mController = new AssistContextPreferenceController(mContext, mLifecycle);
    ReflectionHelpers.setField(mController, "mSettingObserver", mObserver);
}
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