Search in sources :

Example 11 with PreferenceScreen

use of android.preference.PreferenceScreen in project nmid-headline by miao1007.

the class SupportPreferenceFragment method addPreferencesFromResource.

public void addPreferencesFromResource(int resId) {
    requirePreferenceManager();
    try {
        Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
        m.setAccessible(true);
        PreferenceScreen screen = (PreferenceScreen) m.invoke(mPreferenceManager, getActivity(), resId, getPreferenceScreen());
        setPreferenceScreen(screen);
    } catch (Exception ignored) {
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Method(java.lang.reflect.Method)

Example 12 with PreferenceScreen

use of android.preference.PreferenceScreen in project nmid-headline by miao1007.

the class SupportPreferenceFragment method onSaveInstanceState.

public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        Bundle container = new Bundle();
        preferenceScreen.saveHierarchyState(container);
        outState.putBundle(PREFERENCES_TAG, container);
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Bundle(android.os.Bundle)

Example 13 with PreferenceScreen

use of android.preference.PreferenceScreen in project nmid-headline by miao1007.

the class SupportPreferenceFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (mHavePrefs) {
        bindPreferences();
    }
    mInitDone = true;
    if (savedInstanceState != null) {
        Bundle container = savedInstanceState.getBundle(PREFERENCES_TAG);
        if (container != null) {
            final PreferenceScreen preferenceScreen = getPreferenceScreen();
            if (preferenceScreen != null) {
                preferenceScreen.restoreHierarchyState(container);
            }
        }
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Bundle(android.os.Bundle)

Example 14 with PreferenceScreen

use of android.preference.PreferenceScreen in project zxingfragmentlib by mitoyarzun.

the class PreferencesFragment method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.preferences);
    PreferenceScreen preferences = getPreferenceScreen();
    preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    checkBoxPrefs = findDecodePrefs(preferences, PreferencesActivity.KEY_DECODE_1D_PRODUCT, PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL, PreferencesActivity.KEY_DECODE_QR, PreferencesActivity.KEY_DECODE_DATA_MATRIX, PreferencesActivity.KEY_DECODE_AZTEC, PreferencesActivity.KEY_DECODE_PDF417);
    disableLastCheckedPref();
    EditTextPreference customProductSearch = (EditTextPreference) preferences.findPreference(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH);
    customProductSearch.setOnPreferenceChangeListener(new CustomSearchURLValidator());
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) EditTextPreference(android.preference.EditTextPreference)

Example 15 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)

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