Search in sources :

Example 21 with PreferenceScreen

use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.

the class PGFragmentTable method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null)
        actionBar.setTitle("Table " + mTableName);
    final SQLiteDatabase database = mSQLiteOpenHelper.getReadableDatabase();
    final List<MDLUser> records = MDLUser.fetchAll(database);
    database.close();
    if (!records.equals(mRecords)) {
        this.mRecords = records;
        reload(records);
        final PreferenceScreen preferenceScreen = getPreferenceScreen();
        preferenceScreen.removeAll();
        for (final MDLUser user : records) {
            final PGListItemRecord item = new PGListItemRecord(getActivity(), user);
            item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

                @Override
                public boolean onPreferenceClick(Preference preference) {
                    return onRecordPressed((PGListItemRecord) preference);
                }
            });
            preferenceScreen.addPreference(item);
        }
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Preference(android.preference.Preference) ActionBar(android.app.ActionBar)

Example 22 with PreferenceScreen

use of android.preference.PreferenceScreen in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class SettingsFragment method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setHasOptionsMenu(true);
    setInputMethodSettingsCategoryTitle(R.string.language_selection_title);
    setSubtypeEnablerTitle(R.string.select_language);
    addPreferencesFromResource(R.xml.prefs);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
    if (!ProductionFlags.ENABLE_ACCOUNT_SIGN_IN) {
        final Preference accountsPreference = findPreference(Settings.SCREEN_ACCOUNTS);
        preferenceScreen.removePreference(accountsPreference);
    }
    if (!JniUtils.mHaveGestureLib) {
        final Preference gesturePreference = findPreference(Settings.SCREEN_GESTURE);
        preferenceScreen.removePreference(gesturePreference);
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Preference(android.preference.Preference)

Example 23 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 24 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);
    mManagedPreferenceDelegate = createManagedPreferenceDelegate();
    ChromeBaseCheckBoxPreference networkPredictionPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(PrefServiceBridge.getInstance().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));
    }
    ChromeBaseCheckBoxPreference safeBrowsingExtendedReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    safeBrowsingExtendedReportingPref.setOnPreferenceChangeListener(this);
    safeBrowsingExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    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 : ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) PreferenceScreen(android.preference.PreferenceScreen)

Example 25 with PreferenceScreen

use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.

the class UsbDevicePreferences method resetList.

private void resetList() {
    getPreferenceScreen().removeAll();
    addPreferencesFromResource(R.xml.usb_device_preferences);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    Preference header = preferenceScreen.findPreference(PREF_OBJECT_NAME);
    header.setTitle(mUsbInfo.getName());
    header.setOnPreferenceClickListener(this);
    for (int i = 0; i < mSites.size(); ++i) {
        Website site = mSites.get(i);
        Preference preference = new WebsitePreference(getActivity(), site, mCategory);
        preference.getExtras().putSerializable(SingleWebsitePreferences.EXTRA_SITE, site);
        preference.setFragment(SingleWebsitePreferences.class.getCanonicalName());
        preferenceScreen.addPreference(preference);
    }
    // Force this list to be reloaded if the activity is resumed.
    mSites = null;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Preference(android.preference.Preference)

Aggregations

PreferenceScreen (android.preference.PreferenceScreen)83 Preference (android.preference.Preference)36 ListPreference (android.preference.ListPreference)21 PreferenceCategory (android.preference.PreferenceCategory)17 CheckBoxPreference (android.preference.CheckBoxPreference)16 EditTextPreference (android.preference.EditTextPreference)14 Bundle (android.os.Bundle)13 Method (java.lang.reflect.Method)11 SharedPreferences (android.content.SharedPreferences)9 Intent (android.content.Intent)6 Dialog (android.app.Dialog)5 ArrayList (java.util.ArrayList)5 DialogInterface (android.content.DialogInterface)4 Activity (android.app.Activity)3 Context (android.content.Context)3 MultiSelectListPreference (android.preference.MultiSelectListPreference)3 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)3 PreferenceManager (android.preference.PreferenceManager)3 TwoStatePreference (android.preference.TwoStatePreference)3 View (android.view.View)3