Search in sources :

Example 91 with PreferenceScreen

use of android.preference.PreferenceScreen in project Memento-Calendar by alexstyl.

the class PreferenceManagerCompat method inflateFromResource.

/**
 * Inflates a preference hierarchy from XML. If a preference hierarchy is
 * given, the new preference hierarchies will be merged in.
 *
 * @param context The context of the resource.
 * @param resId The resource ID of the XML to inflate.
 * @param rootPreferences Optional existing hierarchy to merge the new
 *            hierarchies into.
 * @return The root hierarchy (if one was not provided, the new hierarchy's
 *         root).
 * @hide
 */
static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) {
    try {
        Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
        m.setAccessible(true);
        PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, activity, resId, screen);
        return prefScreen;
    } catch (Exception e) {
        Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e);
    }
    return null;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Method(java.lang.reflect.Method)

Example 92 with PreferenceScreen

use of android.preference.PreferenceScreen in project Memento-Calendar by alexstyl.

the class PreferenceFragment 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 93 with PreferenceScreen

use of android.preference.PreferenceScreen in project Thrift-box by Sash0k.

the class PreferenceManagerCompat method inflateFromResource.

/**
 * Inflates a preference hierarchy from XML. If a preference hierarchy is
 * given, the new preference hierarchies will be merged in.
 *
 * @param context The context of the resource.
 * @param resId The resource ID of the XML to inflate.
 * @param rootPreferences Optional existing hierarchy to merge the new
 *            hierarchies into.
 * @return The root hierarchy (if one was not provided, the new hierarchy's
 *         root).
 * @hide
 */
static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) {
    try {
        Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
        m.setAccessible(true);
        PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, activity, resId, screen);
        return prefScreen;
    } catch (Exception e) {
        Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e);
    }
    return null;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Method(java.lang.reflect.Method)

Example 94 with PreferenceScreen

use of android.preference.PreferenceScreen in project Thrift-box by Sash0k.

the class PreferenceManagerCompat method getPreferenceScreen.

/**
 * Returns the root of the preference hierarchy managed by this class.
 *
 * @return The {@link PreferenceScreen} object that is at the root of the hierarchy.
 */
static PreferenceScreen getPreferenceScreen(PreferenceManager manager) {
    try {
        Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen");
        m.setAccessible(true);
        return (PreferenceScreen) m.invoke(manager);
    } catch (Exception e) {
        Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e);
    }
    return null;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Method(java.lang.reflect.Method)

Example 95 with PreferenceScreen

use of android.preference.PreferenceScreen in project Thrift-box by Sash0k.

the class PreferenceFragment 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)

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