use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TrustAgentsPreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mPackageManager = (ShadowApplicationPackageManager) Shadows.shadowOf(mContext.getPackageManager());
mController = new TrustAgentsPreferenceController(mContext, "pref_key");
mPreferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreferenceScreen.setKey("pref_key");
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDetailsControllerTestBase method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mDeviceConfig = makeDefaultDeviceConfig();
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);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = spy(new Lifecycle(mLifecycleOwner));
mBluetoothManager = new BluetoothManager(mContext);
mBluetoothAdapter = mBluetoothManager.getAdapter();
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsPowerRoleControllerTest 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);
mDetailsPowerRoleController = new UsbDetailsPowerRoleController(mContext, mFragment, mUsbBackend);
mPreference = new PreferenceCategory(mContext);
mPreference.setKey(mDetailsPowerRoleController.getPreferenceKey());
mScreen.addPreference(mPreference);
mDetailsPowerRoleController.mHandler = mHandler;
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class GameDriverAppPreferenceControllerTest method loadConfig.
private void loadConfig(String optIn, String prereleaseOptIn, String optOut) {
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS, optIn);
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, prereleaseOptIn);
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS, optOut);
mController = new GameDriverAppPreferenceController(mContext, "testKey");
mGroup = spy(new PreferenceCategory(mContext));
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
when(mGroup.getContext()).thenReturn(mContext);
when(mGroup.getPreferenceManager()).thenReturn(preferenceManager);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mGroup);
mController.displayPreference(mScreen);
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InstantAppButtonsPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
final PackageInfo packageInfo = mock(PackageInfo.class);
packageInfo.applicationInfo = mAppInfo;
when(mFragment.getPackageInfo()).thenReturn(packageInfo);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
final View buttons = View.inflate(RuntimeEnvironment.application, R.layout.instant_app_buttons, null);
mLaunchButton = buttons.findViewById(R.id.launch);
mInstallButton = buttons.findViewById(R.id.install);
mClearAppButton = buttons.findViewById(R.id.clear_data);
mController = spy(new InstantAppButtonsPreferenceController(mContext, mFragment, TEST_AIA_PACKAGE_NAME, null));
when(mPreference.getKey()).thenReturn("instant_app_buttons");
mScreen.addPreference(mPreference);
when(mPreference.findViewById(R.id.instant_app_button_container)).thenReturn(buttons);
}
Aggregations