use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotifyOpenNetworkPreferenceControllerTest method handlePreferenceTreeClick_nonMatchingType_shouldDoNothing.
@Test
public void handlePreferenceTreeClick_nonMatchingType_shouldDoNothing() {
final Preference pref = new Preference(mContext);
pref.setKey(mController.getPreferenceKey());
assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class P2pThisDevicePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mPreference = new Preference(RuntimeEnvironment.application);
when(mPreferenceScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new P2pThisDevicePreferenceController(RuntimeEnvironment.application);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiWakeupPreferenceControllerTest method handlePreferenceTreeClick_nonMatchingType_shouldDoNothing.
@Test
public void handlePreferenceTreeClick_nonMatchingType_shouldDoNothing() {
final Preference pref = new Preference(mContext);
pref.setKey(mController.getPreferenceKey());
assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UseOpenWifiPreferenceControllerTest method onPreferenceChange_notAvailable_shouldDoNothing.
@Test
public void onPreferenceChange_notAvailable_shouldDoNothing() {
createController();
final Preference pref = new Preference(mContext);
pref.setKey(mController.getPreferenceKey());
assertThat(mController.onPreferenceChange(pref, null)).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSettings method onCreateContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) {
Preference preference = (Preference) view.getTag();
if (preference instanceof LongPressAccessPointPreference) {
mSelectedAccessPoint = ((LongPressAccessPointPreference) preference).getAccessPoint();
menu.setHeaderTitle(mSelectedAccessPoint.getTitle());
if (mSelectedAccessPoint.isConnectable()) {
menu.add(Menu.NONE, MENU_ID_CONNECT, 0, /* order */
R.string.wifi_connect);
}
WifiConfiguration config = mSelectedAccessPoint.getConfig();
// Some configs are ineditable
if (WifiUtils.isNetworkLockedDown(getActivity(), config)) {
return;
}
// could only be disconnected and be put in blacklists so it won't be used again.
if (mSelectedAccessPoint.isSaved() || mSelectedAccessPoint.isEphemeral()) {
final int stringId = mSelectedAccessPoint.isEphemeral() ? R.string.wifi_disconnect_button_text : R.string.forget;
menu.add(Menu.NONE, MENU_ID_FORGET, 0, /* order */
stringId);
}
if (mSelectedAccessPoint.isSaved() && !mSelectedAccessPoint.isActive()) {
menu.add(Menu.NONE, MENU_ID_MODIFY, 0, /* order */
R.string.wifi_modify);
}
}
}
Aggregations