Search in sources :

Example 66 with PreferenceScreen

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);
}
Also used : PreferenceScreen(android.preference.PreferenceScreen)

Example 67 with PreferenceScreen

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);
    }
}
Also used : VpnType(android.net.vpn.VpnType) PreferenceScreen(android.preference.PreferenceScreen) Preference(android.preference.Preference)

Example 68 with PreferenceScreen

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);
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) StoragePoint(com.owncloud.android.datastorage.StoragePoint)

Example 69 with 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);
    }
}
Also used : Account(android.accounts.Account) ChromeBasePreference(org.chromium.chrome.browser.preferences.ChromeBasePreference) PreferenceScreen(android.preference.PreferenceScreen) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Preferences(org.chromium.chrome.browser.preferences.Preferences) Paint(android.graphics.Paint)

Example 70 with PreferenceScreen

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();
}
Also used : PrefServiceBridge(org.chromium.chrome.browser.preferences.PrefServiceBridge) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) PreferenceScreen(android.preference.PreferenceScreen)

Aggregations

PreferenceScreen (android.preference.PreferenceScreen)153 Preference (android.preference.Preference)68 ListPreference (android.preference.ListPreference)42 CheckBoxPreference (android.preference.CheckBoxPreference)38 PreferenceCategory (android.preference.PreferenceCategory)32 Bundle (android.os.Bundle)26 EditTextPreference (android.preference.EditTextPreference)24 Method (java.lang.reflect.Method)20 Intent (android.content.Intent)19 SharedPreferences (android.content.SharedPreferences)11 RingtonePreference (android.preference.RingtonePreference)9 Test (org.junit.Test)9 Context (android.content.Context)8 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)8 TwoStatePreference (android.preference.TwoStatePreference)8 AlertDialog (android.support.v7.app.AlertDialog)8 OsmandApplication (net.osmand.plus.OsmandApplication)8 ArrayList (java.util.ArrayList)7 SuppressLint (android.annotation.SuppressLint)6 ComponentName (android.content.ComponentName)6