use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class FirmwareVersionPreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final Context context = RuntimeEnvironment.application;
final PreferenceManager preferenceManager = new PreferenceManager(context);
mController = new FirmwareVersionPreferenceController(context, KEY);
mPreference = new Preference(context);
mPreference.setKey(KEY);
mScreen = preferenceManager.createPreferenceScreen(context);
mScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class InstantAppButtonsPreferenceControllerTest method setUp.
@Before
public void setUp() throws PackageManager.NameNotFoundException {
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);
final InstallSourceInfo installSourceInfo = mock(InstallSourceInfo.class);
when(mPackageManager.getInstallSourceInfo(TEST_AIA_PACKAGE_NAME)).thenReturn(installSourceInfo);
when(installSourceInfo.getInstallingPackageName()).thenReturn(TEST_INSTALLER_PACKAGE_NAME);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
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 android_packages_apps_Settings by omnirom.
the class UsbDetailsHeaderControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
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);
ShadowEntityHeaderController.setUseMock(mHeaderController);
mDetailsHeaderController = new UsbDetailsHeaderController(mContext, mFragment, mUsbBackend);
mPreference = new LayoutPreference(mContext, R.layout.settings_entity_header);
mPreference.setKey(mDetailsHeaderController.getPreferenceKey());
mScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class UsbDetailsTranscodeMtpControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
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);
mUnderTest = new UsbDetailsTranscodeMtpController(mContext, mFragment, mUsbBackend);
mPreference = new PreferenceCategory(mContext);
mPreference.setKey(mUnderTest.getPreferenceKey());
mScreen.addPreference(mPreference);
}
Aggregations