Search in sources :

Example 56 with PreferenceScreen

use of android.preference.PreferenceScreen in project Conversations by siacs.

the class SettingsFragment method openPreferenceScreen.

private void openPreferenceScreen(final String screenName) {
    final Preference pref = findPreference(screenName);
    if (pref instanceof PreferenceScreen) {
        final PreferenceScreen preferenceScreen = (PreferenceScreen) pref;
        getActivity().setTitle(preferenceScreen.getTitle());
        preferenceScreen.setDependency("");
        setPreferenceScreen((PreferenceScreen) pref);
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Preference(android.preference.Preference)

Example 57 with PreferenceScreen

use of android.preference.PreferenceScreen in project zxing-lib by kennydude.

the class PreferencesActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    PreferenceScreen preferences = getPreferenceScreen();
    preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    decode1D = (CheckBoxPreference) preferences.findPreference(KEY_DECODE_1D);
    decodeQR = (CheckBoxPreference) preferences.findPreference(KEY_DECODE_QR);
    decodeDataMatrix = (CheckBoxPreference) preferences.findPreference(KEY_DECODE_DATA_MATRIX);
    disableLastCheckedPref();
}
Also used : PreferenceScreen(android.preference.PreferenceScreen)

Example 58 with PreferenceScreen

use of android.preference.PreferenceScreen in project xabber-android by redsolution.

the class BaseSettingsFragment method setPreferences.

/**
 * Set values to the UI elements.
 *
 * @param source
 */
protected void setPreferences(Map<String, Object> source) {
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    for (int index = 0; index < preferenceScreen.getPreferenceCount(); index++) {
        Preference preference = preferenceScreen.getPreference(index);
        Object value = source.get(preference.getKey());
        setPreference(preference, value);
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) RingtonePreference(com.xabber.android.ui.widget.RingtonePreference) CheckBoxPreference(android.preference.CheckBoxPreference) EditTextPreference(android.preference.EditTextPreference) ListPreference(android.preference.ListPreference) Preference(android.preference.Preference) SwitchPreference(android.preference.SwitchPreference)

Example 59 with PreferenceScreen

use of android.preference.PreferenceScreen in project xabber-android by redsolution.

the class DebugSettingsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preference_debug);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.removePreference(preferenceScreen.findPreference(getString(R.string.debug_log_key)));
    preferenceScreen.removePreference(preferenceScreen.findPreference(getString(R.string.cache_clear_key)));
    preferenceScreen.removePreference(preferenceScreen.findPreference(getString(R.string.debug_connection_errors_key)));
    Preference prefDownloadArchive = preferenceScreen.findPreference(getString(R.string.debug_download_all_messages_key));
    prefDownloadArchive.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            startMessageArchiveDownload();
            return true;
        }
    });
    Preference prefFetchCrowdfundingFeed = preferenceScreen.findPreference(getString(R.string.debug_fetch_crowdfunding_feed_key));
    if (prefFetchCrowdfundingFeed != null) {
        prefFetchCrowdfundingFeed.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

            @Override
            public boolean onPreferenceClick(Preference preference) {
                CrowdfundingManager.getInstance().fetchFeedForDebug();
                Toast.makeText(getActivity(), "Crowdfunding feed updated", Toast.LENGTH_SHORT).show();
                return true;
            }
        });
    }
    if (!BuildConfig.DEBUG) {
        preferenceScreen.removePreference(prefDownloadArchive);
    }
    if (!SettingsManager.isCrashReportsSupported()) {
        preferenceScreen.removePreference(preferenceScreen.findPreference(getString(R.string.debug_crash_reports_key)));
    }
    PreferenceSummaryHelperActivity.updateSummary(preferenceScreen);
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Preference(android.preference.Preference)

Example 60 with PreferenceScreen

use of android.preference.PreferenceScreen in project xabber-android by redsolution.

the class PresenceSettingsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preference_presence);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    PreferenceSummaryHelperActivity.updateSummary(preferenceScreen);
}
Also used : 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