Search in sources :

Example 81 with Lifecycle

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

the class SavedDeviceGroupControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    doReturn(mContext).when(mDashboardFragment).getContext();
    doReturn(mPackageManager).when(mContext).getPackageManager();
    mSavedDeviceGroupController = new SavedDeviceGroupController(mContext);
    mSavedDeviceGroupController.setBluetoothDeviceUpdater(mBluetoothDeviceUpdater);
    mSavedDeviceGroupController.setSavedDockUpdater(mSavedDockUpdater);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 82 with Lifecycle

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

the class UsbDetailsDataRoleControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycle = new Lifecycle(() -> mLifecycle);
    mPreferenceManager = new PreferenceManager(mContext);
    mScreen = mPreferenceManager.createPreferenceScreen(mContext);
    when(mFragment.getActivity()).thenReturn(mActivity);
    when(mActivity.getApplicationContext()).thenReturn(mContext);
    when(mFragment.getContext()).thenReturn(mContext);
    when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
    when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
    mDetailsDataRoleController = new UsbDetailsDataRoleController(mContext, mFragment, mUsbBackend);
    mPreference = new PreferenceCategory(mContext);
    mPreference.setKey(mDetailsDataRoleController.getPreferenceKey());
    mScreen.addPreference(mPreference);
    mDetailsDataRoleController.mHandler = mHandler;
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Example 83 with Lifecycle

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

the class UsbDetailsFunctionsControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mLifecycle = new Lifecycle(() -> mLifecycle);
    mPreferenceManager = new PreferenceManager(mContext);
    mScreen = mPreferenceManager.createPreferenceScreen(mContext);
    when(mFragment.getActivity()).thenReturn(mActivity);
    when(mActivity.getApplicationContext()).thenReturn(mContext);
    when(mFragment.getContext()).thenReturn(mContext);
    when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
    when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
    when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
    mDetailsFunctionsController = new UsbDetailsFunctionsController(mContext, mFragment, mUsbBackend);
    mPreferenceCategory = new PreferenceCategory(mContext);
    mPreferenceCategory.setKey(mDetailsFunctionsController.getPreferenceKey());
    mScreen.addPreference(mPreferenceCategory);
    mDetailsFunctionsController.displayPreference(mScreen);
    mRadioButtonPreference = new RadioButtonPreference(mContext);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) PreferenceManager(androidx.preference.PreferenceManager) RadioButtonPreference(com.android.settings.widget.RadioButtonPreference) Before(org.junit.Before)

Example 84 with Lifecycle

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

the class LogPersistPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = spy(new LogPersistPreferenceController(mContext, mFragment, mLifecycle));
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    SystemProperties.set("ro.debuggable", "1");
    mController.displayPreference(mScreen);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 85 with Lifecycle

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

the class PictureColorModePreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = new PictureColorModePreferenceController(mContext, mLifecycle);
    when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    when(mContext.getResources()).thenReturn(mResources);
    when(mResources.getIntArray(R.array.color_mode_ids)).thenReturn(new int[0]);
    mController.displayPreference(mPreferenceScreen);
}
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