Search in sources :

Example 61 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 62 with PreferenceScreen

use of android.preference.PreferenceScreen in project carat by amplab.

the class PreferenceFragment method onSaveInstanceState.

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    final 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 63 with PreferenceScreen

use of android.preference.PreferenceScreen in project FBReaderJ by geometer.

the class EditStyleActivity method onCreate.

@Override
protected void onCreate(Bundle bundle) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(bundle);
    Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
    final PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(this);
    setPreferenceScreen(screen);
    myCollection.bindToService(this, new Runnable() {

        public void run() {
            myStyle = myCollection.getHighlightingStyle(getIntent().getIntExtra(STYLE_ID_KEY, -1));
            if (myStyle == null) {
                finish();
                return;
            }
            screen.addPreference(new NamePreference());
            screen.addPreference(new InvisiblePreference());
            myBgColorPreference = new BgColorPreference();
            screen.addPreference(myBgColorPreference);
        }
    });
}
Also used : PreferenceScreen(android.preference.PreferenceScreen)

Example 64 with PreferenceScreen

use of android.preference.PreferenceScreen in project Ushahidi_Android by ushahidi.

the class Settings method createPreferenceHierarchy.

private PreferenceScreen createPreferenceHierarchy() {
    // ROOT element
    PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
    // Basic preferences
    PreferenceCategory basicPrefCat = new PreferenceCategory(this);
    basicPrefCat.setTitle(R.string.basic_settings);
    root.addPreference(basicPrefCat);
    // Total reports to fetch at a time
    // set list values
    // TODO:// need to look into how to properly handle this. It looks ugly
    // but it works.
    CharSequence[] totalReportsEntries = { "20 ".concat(recentReports), "40 ".concat(recentReports), "60 ".concat(recentReports), "80 ".concat(recentReports), "100 ".concat(recentReports), "250 ".concat(recentReports), "500 ".concat(recentReports), "1000 ".concat(recentReports) };
    CharSequence[] totalReportsValues = { "20", "40", "60", "80", "100", "250", "500", "1000" };
    CharSequence[] mapTileEntries = { "Google Tiles", "OSM Tiles ", "Mapbox Tiles" };
    CharSequence[] mapTileValues = { "google", "osm", "mapbox" };
    totalReportsPref.setEntries(totalReportsEntries);
    totalReportsPref.setEntryValues(totalReportsValues);
    totalReportsPref.setDefaultValue(totalReportsValues[0]);
    totalReportsPref.setDialogTitle(R.string.total_reports);
    totalReportsPref.setKey("total_reports_preference");
    totalReportsPref.setTitle(R.string.total_reports);
    totalReportsPref.setSummary(R.string.hint_total_reports);
    basicPrefCat.addPreference(totalReportsPref);
    // Map tile preference
    mapTileProviderPref.setEntries(mapTileEntries);
    mapTileProviderPref.setKey(MAP_TILE_PROVIDER_PREFERENCE);
    mapTileProviderPref.setTitle(R.string.map_tiles);
    mapTileProviderPref.setSummary(R.string.map_tiles_summary);
    mapTileProviderPref.setDialogTitle(R.string.map_tiles);
    mapTileProviderPref.setEntryValues(mapTileValues);
    mapTileProviderPref.setDefaultValue(mapTileValues[0]);
    basicPrefCat.addPreference(mapTileProviderPref);
    // First name entry field
    firstNamePref.setDialogTitle(R.string.txt_first_name);
    firstNamePref.setKey("first_name_preference");
    firstNamePref.setTitle(R.string.txt_first_name);
    firstNamePref.setSummary(R.string.hint_first_name);
    firstNamePref.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    basicPrefCat.addPreference(firstNamePref);
    // Last name entry field
    lastNamePref.setDialogTitle(R.string.txt_last_name);
    lastNamePref.setKey("last_name_preference");
    lastNamePref.setTitle(R.string.txt_last_name);
    lastNamePref.setSummary(R.string.hint_last_name);
    lastNamePref.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    basicPrefCat.addPreference(lastNamePref);
    // Email name entry field
    emailAddressPref.setDialogTitle(R.string.txt_email);
    emailAddressPref.setKey("email_address_preference");
    emailAddressPref.setTitle(R.string.txt_email);
    emailAddressPref.setSummary(R.string.hint_email);
    emailAddressPref.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    basicPrefCat.addPreference(emailAddressPref);
    // phone number entry field
    phoneNumberPref.setDialogTitle(R.string.txt_phonenumber);
    phoneNumberPref.setKey("phone_number_preference");
    phoneNumberPref.setTitle(R.string.txt_phonenumber);
    phoneNumberPref.setSummary(R.string.hint_phonenumber);
    phoneNumberPref.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);
    // GeneratePhotoFilename resize seekbar
    basicPrefCat.addPreference(photoSizePref);
    return root;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) PreferenceCategory(android.preference.PreferenceCategory)

Example 65 with PreferenceScreen

use of android.preference.PreferenceScreen in project android_packages_apps_Settings by LineageOS.

the class ChooseLockGeneric method updatePreferencesOrFinish.

private void updatePreferencesOrFinish() {
    int quality = getIntent().getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
    if (quality == -1) {
        // If caller didn't specify password quality, show the UI and allow the user to choose.
        quality = mChooseLockSettingsHelper.utils().getKeyguardStoredPasswordQuality();
        final PreferenceScreen prefScreen = getPreferenceScreen();
        if (prefScreen != null) {
            prefScreen.removeAll();
        }
        addPreferencesFromResource(R.xml.security_settings_picker);
        disableUnusablePreferences(mDPM.getPasswordQuality(null));
    } else {
        updateUnlockMethodAndFinish(quality);
    }
}
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