use of android.preference.PreferenceScreen in project android_packages_apps_Settings by LineageOS.
the class WifiAPITest method onCreatePreferences.
private void onCreatePreferences() {
addPreferencesFromResource(R.layout.wifi_api_test);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
mWifiDisconnect = (Preference) preferenceScreen.findPreference(KEY_DISCONNECT);
mWifiDisconnect.setOnPreferenceClickListener(this);
mWifiDisableNetwork = (Preference) preferenceScreen.findPreference(KEY_DISABLE_NETWORK);
mWifiDisableNetwork.setOnPreferenceClickListener(this);
mWifiEnableNetwork = (Preference) preferenceScreen.findPreference(KEY_ENABLE_NETWORK);
mWifiEnableNetwork.setOnPreferenceClickListener(this);
}
use of android.preference.PreferenceScreen in project android_packages_apps_Settings by LineageOS.
the class VpnTypeSelection method initTypeList.
private void initTypeList() {
PreferenceScreen root = getPreferenceScreen();
for (VpnType t : VpnManager.getSupportedVpnTypes()) {
String displayName = t.getDisplayName();
String message = String.format(getString(R.string.vpn_edit_title_add), displayName);
mTypeMap.put(message, t);
Preference pref = new Preference(this);
pref.setTitle(message);
pref.setSummary(t.getDescriptionId());
root.addPreference(pref);
}
}
use of android.preference.PreferenceScreen in project android by nextcloud.
the class SettingsActivity method onCreate.
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
if (ThemeUtils.themingEnabled(this)) {
setTheme(R.style.FallbackThemingTheme);
}
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
setupActionBar();
// Register context menu for list of preferences.
registerForContextMenu(getListView());
int accentColor = ThemeColorUtils.primaryAccentColor(this);
String appVersion = getAppVersion();
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
user = accountManager.getUser();
// retrieve user's base uri
setupBaseUri();
// General
setupGeneralCategory(accentColor);
// Synced folders
setupAutoUploadCategory(accentColor, preferenceScreen);
// Details
setupDetailsCategory(accentColor, preferenceScreen);
// More
setupMoreCategory(accentColor);
// About
setupAboutCategory(accentColor, appVersion);
// Dev
setupDevCategory(accentColor, preferenceScreen);
}
use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method updateAccountsList.
private void updateAccountsList() {
PreferenceScreen prefScreen = getPreferenceScreen();
if (prefScreen == null)
return;
for (int i = 0; i < mAccountsListPreferences.size(); i++) {
prefScreen.removePreference(mAccountsListPreferences.get(i));
}
mAccountsListPreferences.clear();
final Preferences activity = (Preferences) getActivity();
Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts();
int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;
for (Account account : accounts) {
ChromeBasePreference pref = new ChromeBasePreference(activity);
pref.setSelectable(false);
pref.setTitle(account.name);
boolean isChildAccount = ChildAccountService.isChildAccount();
pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources())));
pref.setOrder(nextPrefOrder++);
prefScreen.addPreference(pref);
mAccountsListPreferences.add(pref);
}
}
use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.
the class PrivacyPreferences method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
privacyPrefManager.migrateNetworkPredictionPreferences();
addPreferencesFromResource(R.xml.privacy_preferences);
getActivity().setTitle(R.string.prefs_privacy);
setHasOptionsMenu(true);
PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
ChromeBaseCheckBoxPreference networkPredictionPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
networkPredictionPref.setOnPreferenceChangeListener(this);
networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference navigationErrorPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
navigationErrorPref.setOnPreferenceChangeListener(this);
navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference searchSuggestionsPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
searchSuggestionsPref.setOnPreferenceChangeListener(this);
searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
PreferenceScreen preferenceScreen = getPreferenceScreen();
if (!ContextualSearchFieldTrial.isEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
}
// Listen to changes to both Extended Reporting prefs.
ChromeBaseCheckBoxPreference legacyExtendedReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference scoutReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
scoutReportingPref.setOnPreferenceChangeListener(this);
scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
// Remove the extended reporting preference that is NOT active.
String extended_reporting_pref_to_remove = prefServiceBridge.isSafeBrowsingScoutReportingActive() ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));
ChromeBaseCheckBoxPreference safeBrowsingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
safeBrowsingPref.setOnPreferenceChangeListener(this);
safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
if (!PhysicalWeb.featureIsEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
}
updateSummaries();
}
Aggregations