Java Code Examples for android.support.v7.preference.EditTextPreference#setSummary()

The following examples show how to use android.support.v7.preference.EditTextPreference#setSummary() . 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: SettingsFragment.java    From android_gisapp with GNU General Public License v3.0 6 votes vote down vote up
public static void initializeAccurateTaking(EditTextPreference accurateMaxCount)
{
    accurateMaxCount.setSummary(accurateMaxCount.getText());

    accurateMaxCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
    {
        @Override
        public boolean onPreferenceChange(
                Preference preference,
                Object newValue)
        {
            preference.setSummary((CharSequence) newValue);
            return true;
        }
    });
}
 
Example 2
Source File: SettingsActivity.java    From video-quickstart-android with MIT License 5 votes vote down vote up
private void setupSenderBandwidthPreferences(String key,
                                             String defaultValue,
                                             EditTextPreference editTextPreference) {
    String value = sharedPreferences.getString(key, defaultValue);

    // Set layout with input type number for edit text
    editTextPreference.setDialogLayoutResource(R.layout.preference_dialog_number_edittext);
    editTextPreference.setSummary(value);
    editTextPreference.setOnPreferenceChangeListener((preference, newValue) -> {
        preference.setSummary(newValue.toString());
        return true;
    });
}
 
Example 3
Source File: SettingsActivity.java    From stockita-point-of-sale with MIT License 5 votes vote down vote up
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

    if (key.equals("pref_discount")) {

        Preference preference = findPreference(key);
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(sharedPreferences.getString(key, String.valueOf(editTextPreference.getSummary())));

    }
}
 
Example 4
Source File: SettingsActivity.java    From stockita-point-of-sale with MIT License 5 votes vote down vote up
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

    if (key.equals("pref_service")) {

        Preference preference = findPreference(key);
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(sharedPreferences.getString(key, String.valueOf(editTextPreference.getSummary())));

    }
}
 
Example 5
Source File: SettingsActivity.java    From stockita-point-of-sale with MIT License 5 votes vote down vote up
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

    if (key.equals("pref_tax")) {

        Preference preference = findPreference(key);
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(sharedPreferences.getString(key, String.valueOf(editTextPreference.getSummary())));

    }
}
 
Example 6
Source File: BeaconNotificationPageFragment.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
private void setMessageText(String newValue) {
    EditTextPreference msg_name = (EditTextPreference) findPreference("bn_notification_action_message");
    if (newValue != null && !newValue.isEmpty()) {
        msg_name.setSummary(newValue);
        mActionBeacon.getNotification().setMessage(newValue);
    } else {
        msg_name.setSummary(getString(R.string.pref_bn_default_notification_action_message));
        mActionBeacon.getNotification().setMessage(getString(R.string.pref_bn_default_notification_action_message));
    }
}
 
Example 7
Source File: BeaconActionPageFragment.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
private void setActionParam1(String newValue) {
    EditTextPreference param_name = (EditTextPreference) findPreference("ba_action_param1");
    if (newValue != null && !newValue.isEmpty()) {
        param_name.setSummary(newValue);
        mActionBeacon.setActionParam(newValue);
    } else {
        param_name.setSummary("");
        mActionBeacon.setActionParam("");
    }
}
 
Example 8
Source File: BeaconDetailPageFragment.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
private void setNameText(String newValue) {
    EditTextPreference name = (EditTextPreference) findPreference("bd_name_info");
    if (newValue != null && !newValue.isEmpty()) {
        name.setSummary(newValue);
        mActionBeacon.setName(newValue);
    } else {
        name.setSummary(getString(R.string.pref_bd_default_name));
        mActionBeacon.setName(getString(R.string.pref_bd_default_name));
    }
}
 
Example 9
Source File: PreferencesFragment.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
private void textSummary(String key, int resId) {
    EditTextPreference pref = (EditTextPreference) findPreference(key);
    if (pref == null) {
        Utils.debugLog(TAG, "null preference found for " + key);
    } else {
        pref.setSummary(getString(resId, pref.getText()));
    }
}
 
Example 10
Source File: SettingFragment.java    From ChipHellClient with Apache License 2.0 5 votes vote down vote up
private void setForumAddress() {
    mForumAddress = (EditTextPreference) findPreference(GlobalSetting.FORUM_ADDRESS);
    String forumAddress = GlobalSetting.getForumAddress();
    mForumAddress.setSummary(forumAddress);
    mForumAddress.setText(forumAddress);
    mForumAddress.setOnPreferenceChangeListener(this);
}
 
Example 11
Source File: FragmentSettings.java    From GPSLogger with GNU General Public License v3.0 4 votes vote down vote up
public void SetupPreferences() {

        ListPreference pUM = (ListPreference) findPreference("prefUM");
        ListPreference pUMSpeed = (ListPreference) findPreference("prefUMSpeed");
        ListPreference pGPSDistance = (ListPreference) findPreference("prefGPSdistance");
        ListPreference pGPSUpdateFrequency = (ListPreference) findPreference("prefGPSupdatefrequency");
        ListPreference pKMLAltitudeMode = (ListPreference) findPreference("prefKMLAltitudeMode");
        ListPreference pGPXVersion = (ListPreference) findPreference("prefGPXVersion");
        ListPreference pShowTrackStatsType = (ListPreference) findPreference("prefShowTrackStatsType");
        ListPreference pShowDirections = (ListPreference) findPreference("prefShowDirections");
        ListPreference pViewTracksWith = (ListPreference) findPreference("prefViewTracksWith");
        ListPreference pColorTheme = (ListPreference) findPreference("prefColorTheme");
        EditTextPreference pAltitudeCorrection = (EditTextPreference) findPreference("prefAltitudeCorrectionRaw");

        altcorm = Double.valueOf(prefs.getString("prefAltitudeCorrection", "0"));
        altcor = prefs.getString("prefUM", "0").equals("0") ? altcorm : altcorm * M_TO_FT;

        if (prefs.getString("prefUM", "0").equals("0")) {       // Metric
            pUMSpeed.setEntries(R.array.UMSpeed_Metric);
            pGPSDistance.setEntries(R.array.GPSDistance_Metric);
            pAltitudeCorrection.setSummary(altcor != 0 ? getString(R.string.pref_AltitudeCorrection_summary_offset) + " = " + Double.valueOf(Math.round(altcor*1000d)/1000d).toString() + " m" : getString(R.string.pref_AltitudeCorrection_summary_not_defined));

        }
        if (prefs.getString("prefUM", "0").equals("8")) {       // Imperial
            pUMSpeed.setEntries(R.array.UMSpeed_Imperial);
            pGPSDistance.setEntries(R.array.GPSDistance_Imperial);
            pAltitudeCorrection.setSummary(altcor != 0 ? getString(R.string.pref_AltitudeCorrection_summary_offset) + " = " + Double.valueOf(Math.round(altcor*1000d)/1000d).toString() + " ft" : getString(R.string.pref_AltitudeCorrection_summary_not_defined));
        }
        if (prefs.getString("prefUM", "0").equals("16")) {       // Aerial / Nautical
            pUMSpeed.setEntries(R.array.UMSpeed_AerialNautical);
            pGPSDistance.setEntries(R.array.GPSDistance_Imperial);
            pAltitudeCorrection.setSummary(altcor != 0 ? getString(R.string.pref_AltitudeCorrection_summary_offset) + " = " + Double.valueOf(Math.round(altcor*1000d)/1000d).toString() + " ft" : getString(R.string.pref_AltitudeCorrection_summary_not_defined));
        }

        Log.w("myApp", "[#] FragmentSettings.java - prefAltitudeCorrectionRaw = " + prefs.getString("prefAltitudeCorrectionRaw", "0")) ;
        Log.w("myApp", "[#] FragmentSettings.java - prefAltitudeCorrection = " + prefs.getString("prefAltitudeCorrection", "0")) ;

        // Set all summaries
        pColorTheme.setSummary(pColorTheme.getEntry());
        pUMSpeed.setSummary(pUMSpeed.getEntry());
        pUM.setSummary(pUM.getEntry());
        pGPSDistance.setSummary(pGPSDistance.getEntry());
        pGPSUpdateFrequency.setSummary(pGPSUpdateFrequency.getEntry());
        pKMLAltitudeMode.setSummary(pKMLAltitudeMode.getEntry());
        pGPXVersion.setSummary(pGPXVersion.getEntry());
        pShowTrackStatsType.setSummary(pShowTrackStatsType.getEntry());
        pShowDirections.setSummary(pShowDirections.getEntry());
        pViewTracksWith.setSummary(pViewTracksWith.getEntry());
    }