use of android.support.v7.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.getSsid());
if (mSelectedAccessPoint.isConnectable()) {
menu.add(Menu.NONE, MENU_ID_CONNECT, 0, R.string.wifi_menu_connect);
}
WifiConfiguration config = mSelectedAccessPoint.getConfig();
// Some configs are ineditable
if (isEditabilityLockedDown(getActivity(), config)) {
return;
}
if (mSelectedAccessPoint.isSaved() || mSelectedAccessPoint.isEphemeral()) {
// Allow forgetting a network if either the network is saved or ephemerally
// connected. (In the latter case, "forget" blacklists the network so it won't
// be used again, ephemerally).
menu.add(Menu.NONE, MENU_ID_FORGET, 0, R.string.wifi_menu_forget);
}
// current connected AP, add a disconnect option to it
if (getResources().getBoolean(R.bool.config_auto_connect_wifi_enabled)) {
if (mSelectedAccessPoint.isActive()) {
menu.add(Menu.NONE, MENU_ID_DISCONNECT, 0, R.string.wifi_menu_disconnect);
}
}
if (mSelectedAccessPoint.isSaved()) {
menu.add(Menu.NONE, MENU_ID_MODIFY, 0, R.string.wifi_menu_modify);
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(getActivity());
if (nfcAdapter != null && nfcAdapter.isEnabled() && mSelectedAccessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
// Only allow writing of NFC tags for password-protected networks.
menu.add(Menu.NONE, MENU_ID_WRITE_NFC, 0, R.string.wifi_menu_write_to_nfc);
}
}
}
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.wifi_settings);
mAddPreference = new Preference(getContext());
mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
mAddPreference.setTitle(R.string.wifi_add_network);
mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
mBgThread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
mBgThread.start();
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ApplicationSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.application_settings);
mToggleAdvancedSettings = (CheckBoxPreference) findPreference(KEY_TOGGLE_ADVANCED_SETTINGS);
mToggleAdvancedSettings.setChecked(isAdvancedSettingsEnabled());
getPreferenceScreen().removePreference(mToggleAdvancedSettings);
// not ready for prime time yet
if (false) {
getPreferenceScreen().removePreference(mInstallLocation);
}
mInstallLocation = (ListPreference) findPreference(KEY_APP_INSTALL_LOCATION);
// Is app default install location set?
boolean userSetInstLocation = (Settings.Global.getInt(getContentResolver(), Settings.Global.SET_INSTALL_LOCATION, 0) != 0);
if (!userSetInstLocation) {
getPreferenceScreen().removePreference(mInstallLocation);
} else {
mInstallLocation.setValue(getAppInstallLocation());
mInstallLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = (String) newValue;
handleUpdateAppInstallLocation(value);
return false;
}
});
}
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PrivacySettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Don't allow any access if this is not an admin user.
// TODO: backup/restore currently only works with owner user b/22760572
mEnabled = UserManager.get(getActivity()).isAdminUser();
if (!mEnabled) {
return;
}
addPreferencesFromResource(R.xml.privacy_settings);
final PreferenceScreen screen = getPreferenceScreen();
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
mBackup = (PreferenceScreen) screen.findPreference(BACKUP_DATA);
mAutoRestore = (SwitchPreference) screen.findPreference(AUTO_RESTORE);
mAutoRestore.setOnPreferenceChangeListener(preferenceChangeListener);
mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT);
mManageData = (PreferenceScreen) screen.findPreference(DATA_MANAGEMENT);
Set<String> keysToRemove = new HashSet<>();
getNonVisibleKeys(getActivity(), keysToRemove);
final int screenPreferenceCount = screen.getPreferenceCount();
for (int i = screenPreferenceCount - 1; i >= 0; --i) {
Preference preference = screen.getPreference(i);
if (keysToRemove.contains(preference.getKey())) {
screen.removePreference(preference);
}
}
updateToggles();
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegalSettings method onCreate.
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.about_legal);
final Activity act = getActivity();
// These are contained in the "container" preference group
PreferenceGroup parentPreference = getPreferenceScreen();
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_TERMS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_COPYRIGHT, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_WEBVIEW_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
}
Aggregations