Search in sources :

Example 16 with PreferenceScreen

use of android.preference.PreferenceScreen in project Signal-Android by WhisperSystems.

the class AppProtectionPreferenceFragment method initializePlatformSpecificOptions.

private void initializePlatformSpecificOptions() {
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    Preference screenSecurityPreference = findPreference(TextSecurePreferences.SCREEN_SECURITY_PREF);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH && screenSecurityPreference != null) {
        preferenceScreen.removePreference(screenSecurityPreference);
    }
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) CheckBoxPreference(android.preference.CheckBoxPreference) Preference(android.preference.Preference)

Example 17 with PreferenceScreen

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

the class IndexFragment method initiatePreferenceScreen.

protected PreferenceScreen initiatePreferenceScreen(Base base, int preferencesResID) {
    addPreferencesFromResource(preferencesResID);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    final PreferenceCategory serverCate = getServerCategory(preferenceScreen);
    serverCate.setOrderingAsAdded(true);
    final Server[] servers = base.getServers();
    for (int index = 0; index < servers.length; index++) {
        final Server server = servers[index];
        final ListItemServer item = new ListItemServer(getActivity(), server);
        item.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                onServerItemStateChange((ListItemServer) preference, (Boolean) newValue);
                return false;
            }
        });
        item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

            @Override
            public boolean onPreferenceClick(Preference preference) {
                onServerItemClick((ListItemServer) preference);
                return true;
            }
        });
        serverCate.addPreference(item);
        onServerStateChange(server, index);
    }
    final PreferenceCategory databaseCate = getDatabaseCategory(preferenceScreen);
    final PreferenceScreen playgroundItem = (PreferenceScreen) databaseCate.findPreference(getString(R.string.item_playground));
    playgroundItem.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            return onPlaygroundItemClick(preference);
        }
    });
    return preferenceScreen;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Server(com.nimbusbase.nimbusbase.Server) PreferenceCategory(android.preference.PreferenceCategory) Preference(android.preference.Preference)

Example 18 with PreferenceScreen

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

the class PGFragmentRecord method getAllAttributeItems.

protected List<PGListItemAttribute> getAllAttributeItems() {
    final PreferenceScreen root = getPreferenceScreen();
    List<PGListItemAttribute> items = new ArrayList<PGListItemAttribute>(mAttrTypesByName.size());
    for (int index = 0; index < root.getPreferenceCount(); index++) {
        final PreferenceCategory category = (PreferenceCategory) root.getPreference(index);
        final PGListItemAttribute item = (PGListItemAttribute) category.getPreference(0);
        items.add(item);
    }
    return items;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) PreferenceCategory(android.preference.PreferenceCategory) ArrayList(java.util.ArrayList)

Example 19 with PreferenceScreen

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

the class PGFragmentTable method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    setHasOptionsMenu(true);
    final Bundle bundle = getArguments();
    this.mTableName = bundle.getString(sTableNameKey);
    this.mSQLiteOpenHelper = new MDLDatabaseManager(getActivity());
    final PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(getActivity());
    setPreferenceScreen(preferenceScreen);
    preferenceScreen.setOrderingAsAdded(true);
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Bundle(android.os.Bundle)

Example 20 with PreferenceScreen

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

the class PGFragmentTable method reload.

protected void reload(List<? extends PGRecord> records) {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.removeAll();
    for (final PGRecord 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) 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