Search in sources :

Example 71 with Lifecycle

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

the class BluetoothAudioSampleRatePreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = spy(new BluetoothAudioSampleRatePreferenceController(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)

Example 72 with Lifecycle

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

the class BluetoothAudioQualityPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = spy(new BluetoothAudioQualityPreferenceController(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)

Example 73 with Lifecycle

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

the class PrivateDnsPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mContentResolver = mContext.getContentResolver();
    mShadowContentResolver = Shadow.extract(mContentResolver);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    doNothing().when(mConnectivityManager).registerDefaultNetworkCallback(mCallbackCaptor.capture(), nullable(Handler.class));
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mController = spy(new PrivateDnsPreferenceController(mContext));
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mLifecycle.addObserver(mController);
    mShadowUserManager = ShadowUserManager.getShadow();
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Handler(android.os.Handler) Before(org.junit.Before)

Example 74 with Lifecycle

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

the class SubscriptionsPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(Robolectric.setupActivity(Activity.class));
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
    when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
    when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
    when(mConnectivityManager.getActiveNetwork()).thenReturn(mActiveNetwork);
    when(mConnectivityManager.getNetworkCapabilities(mActiveNetwork)).thenReturn(mCapabilities);
    when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
    when(mScreen.findPreference(eq(KEY))).thenReturn(mPreferenceCategory);
    when(mPreferenceCategory.getContext()).thenReturn(mContext);
    mOnChildUpdatedCount = 0;
    mUpdateListener = () -> mOnChildUpdatedCount++;
    mController = spy(new SubscriptionsPreferenceController(mContext, mLifecycle, mUpdateListener, KEY, 5));
    doReturn(mSignalStrengthIcon).when(mController).getIcon(anyInt(), anyInt(), anyBoolean());
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 75 with Lifecycle

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

the class WifiConnectionPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    WifiTrackerFactory.setTestingWifiTracker(mWifiTracker);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    when(mScreen.findPreference(eq(KEY))).thenReturn(mPreferenceCategory);
    when(mScreen.getContext()).thenReturn(mContext);
    mUpdateListener = () -> mOnChildUpdatedCount++;
    mController = new WifiConnectionPreferenceController(mContext, mLifecycle, mUpdateListener, KEY, 0, 0);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) WifiConnectionPreferenceController(com.android.settings.wifi.WifiConnectionPreferenceController) 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