Java Code Examples for android.preference.ListPreference#getEntry()

The following examples show how to use android.preference.ListPreference#getEntry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsActivity.java    From JayPS-AndroidApp with MIT License 6 votes vote down vote up
private void setStravaSummary() {
    ListPreference strava_auto = (ListPreference) findPreference("STRAVA_AUTO");
    CharSequence listDesc = strava_auto.getEntry();
    strava_auto.setSummary(listDesc);

    Preference strava_screen = findPreference("strava_screen");
    String strava = "Disable";
    if (!_sharedPreferences.getString("strava_token", "").isEmpty()) {
        if (_sharedPreferences.getString("STRAVA_AUTO", "disable").equals("disable")) {
            strava = "Manual upload";
        } else {
            strava = "Automatic upload";
        }
    }
    strava_screen.setSummary(strava);
}
 
Example 2
Source File: SettingsActivity.java    From JayPS-AndroidApp with MIT License 6 votes vote down vote up
private void setRunkeeperSummary() {
    ListPreference runkeeper_auto = (ListPreference) findPreference("RUNKEEPER_AUTO");
    CharSequence listDesc = runkeeper_auto.getEntry();
    runkeeper_auto.setSummary(listDesc);

    ListPreference runkeeper_activity_type = (ListPreference) findPreference("RUNKEEPER_ACTIVITY_TYPE");
    listDesc = runkeeper_activity_type.getEntry();
    runkeeper_activity_type.setSummary(listDesc);

    Preference runkeeper_screen = findPreference("runkeeper_screen");
    String runkeeper = "Disable";
    if (!_sharedPreferences.getString("runkeeper_token", "").isEmpty()) {
        if (_sharedPreferences.getString("RUNKEEPER_AUTO", "disable").equals("disable")) {
            runkeeper = "Manual upload";
        } else {
            runkeeper = "Automatic upload";
        }
    }
    runkeeper_screen.setSummary(runkeeper);
}
 
Example 3
Source File: GenericPrefs.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set summary of a list field If empty will display default summary If one
 * item selected will display item name
 * 
 * @param fieldName the preference key name
 */
public void setListFieldSummary(String fieldName) {
    PreferenceScreen pfs = getPreferenceScreen();
    ListPreference pref = (ListPreference) pfs.findPreference(fieldName);
    if (pref == null) {
        Log.w(THIS_FILE, "Unable to find preference " + fieldName);
        return;
    }

    CharSequence val = pref.getEntry();
    if (TextUtils.isEmpty(val)) {
        val = getDefaultFieldSummary(fieldName);
    }
    setPreferenceSummary(pref, val);
}
 
Example 4
Source File: SettingsFragment.java    From physical-web with Apache License 2.0 5 votes vote down vote up
private void updatePwsPreference() {
  ListPreference listPreference = (ListPreference) findPreference(
      getString(R.string.pws_endpoint_setting_key));
  String entry = (String) listPreference.getEntry();
  if (entry == null) {
    return;
  }

  if (entry.equals(getString(R.string.custom_pws))) {
    // User selected custom PWS therefore need to update it accordingly
    EditTextPreference customPwsUrlPreference =
        (EditTextPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_url_key));
    ListPreference customPwsVersionPreference =
        (ListPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_version_key));
    EditTextPreference customPwsApiKeyPreference =
        (EditTextPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_api_key_key));
    String customPwsUrl = customPwsUrlPreference.getText();
    int customPwsVersion = Integer.parseInt(customPwsVersionPreference.getValue());
    String customPwsApiKey = customPwsApiKeyPreference.getText();
    customPwsUrl = customPwsUrl == null ? "" : customPwsUrl;
    customPwsApiKey = customPwsApiKey == null ? "" : customPwsApiKey;
    listPreference.setValue(Utils.formatEndpointForSharedPrefernces(customPwsUrl,
        customPwsVersion, customPwsApiKey));
    getPreferenceScreen().addPreference(mCustomEndpointCategory);
  } else {
    getPreferenceScreen().removePreference(mCustomEndpointCategory);
  }
}
 
Example 5
Source File: SettingsActivity.java    From JayPS-AndroidApp with MIT License 5 votes vote down vote up
private void setOruxMapsSummary() {
    ListPreference oruxPref = (ListPreference) findPreference("ORUXMAPS_AUTO");
    CharSequence listDesc = oruxPref.getEntry();
    oruxPref.setSummary(listDesc);
    Preference orux_screen = findPreference("orux_screen");
    orux_screen.setSummary(listDesc);
}
 
Example 6
Source File: SettingsActivity.java    From JayPS-AndroidApp with MIT License 5 votes vote down vote up
private void setCanvasSummary() {
    ListPreference canvasPref = (ListPreference) findPreference("CANVAS_MODE");
    CharSequence listDesc = canvasPref.getEntry();
    canvasPref.setSummary(listDesc);
    Preference canvas_screen = findPreference("canvas_screen");
    canvas_screen.setSummary(listDesc);
}