android.support.v7.preference.EditTextPreference Java Examples
The following examples show how to use
android.support.v7.preference.EditTextPreference.
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 |
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 | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.settings); setHasOptionsMenu(true); setupCodecListPreference(AudioCodec.class, PREF_AUDIO_CODEC, PREF_AUDIO_CODEC_DEFAULT, (ListPreference) findPreference(PREF_AUDIO_CODEC)); setupCodecListPreference(VideoCodec.class, PREF_VIDEO_CODEC, PREF_VIDEO_CODEC_DEFAULT, (ListPreference) findPreference(PREF_VIDEO_CODEC)); setupSenderBandwidthPreferences(PREF_SENDER_MAX_AUDIO_BITRATE, PREF_SENDER_MAX_AUDIO_BITRATE_DEFAULT, (EditTextPreference) findPreference(PREF_SENDER_MAX_AUDIO_BITRATE)); setupSenderBandwidthPreferences(PREF_SENDER_MAX_VIDEO_BITRATE, PREF_SENDER_MAX_VIDEO_BITRATE_DEFAULT, (EditTextPreference) findPreference(PREF_SENDER_MAX_VIDEO_BITRATE)); }
Example #3
Source File: BeaconNotificationPageFragment.java From beaconloc with Apache License 2.0 | 5 votes |
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 #4
Source File: SettingFragment.java From ChipHellClient with Apache License 2.0 | 5 votes |
private void setForumAddress() { mForumAddress = (EditTextPreference) findPreference(GlobalSetting.FORUM_ADDRESS); String forumAddress = GlobalSetting.getForumAddress(); mForumAddress.setSummary(forumAddress); mForumAddress.setText(forumAddress); mForumAddress.setOnPreferenceChangeListener(this); }
Example #5
Source File: PreferencesFragment.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
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 #6
Source File: BeaconDetailPageFragment.java From beaconloc with Apache License 2.0 | 5 votes |
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 #7
Source File: BeaconActionPageFragment.java From beaconloc with Apache License 2.0 | 5 votes |
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: SettingsFragment.java From nevo-decorators-sms-captchas with GNU General Public License v3.0 | 5 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { addPreferencesFromResource(R.xml.main_setting); getPreferenceScreen().setEnabled(false); mCaptchaHideOnLocked = (CheckBoxPreference) findPreference(Settings.SETTING_CAPTCHA_HIDE_ON_LOCKED); mCaptchaOverrideDefaultAction = (CheckBoxPreference) findPreference(Settings.SETTING_CAPTCHA_OVERRIDE_DEFAULT_ACTION); mCaptchaPostCopyAction = (ListPreference) findPreference(Settings.SETTING_CAPTCHA_POST_COPY_ACTION); mCaptchaIdentifyPattern = (EditTextPreference) findPreference(Settings.SETTING_CAPTCHA_IDENTIFY_PATTERN); mCaptchaParsePattern = (EditTextPreference) findPreference(Settings.SETTING_CAPTCHA_PARSE_PATTERN); mSubscribeIdentityPattern = (EditTextPreference) findPreference(Settings.SETTING_SUBSCRIBE_IDENTIFY_PATTERN); mSubscribePriority = findPreference(Settings.SETTING_SUBSCRIBE_PRIORITY); mHideInLauncher = (CheckBoxPreference) findPreference(KEY_HIDE_IN_LAUNCHER); mCaptchaHideOnLocked.setOnPreferenceChangeListener(this::onPreferenceChange); mCaptchaOverrideDefaultAction.setOnPreferenceChangeListener(this::onPreferenceChange); mCaptchaPostCopyAction.setOnPreferenceChangeListener(this::onPreferenceChange); mCaptchaIdentifyPattern.setOnPreferenceChangeListener(this::onPreferenceChange); mCaptchaParsePattern.setOnPreferenceChangeListener(this::onPreferenceChange); mSubscribeIdentityPattern.setOnPreferenceChangeListener(this::onPreferenceChange); mHideInLauncher.setOnPreferenceChangeListener(this::onPreferenceChange); mSubscribePriority.setOnPreferenceChangeListener(this::onPreferenceChange); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { mSubscribePriority.setOnPreferenceClickListener((Preference p) -> { startActivity( new Intent("android.settings.APP_NOTIFICATION_SETTINGS"). putExtra("android.provider.extra.APP_PACKAGE" , Global.NEVOLUTION_PACKAGE_NAME)); return false; }); } new Thread(this::loadSettingsAndUpdateViews).start(); }
Example #9
Source File: SettingsFragment.java From RememBirthday with GNU General Public License v3.0 | 5 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.preferences); remindersDaysEditTextPreference = (EditTextPreference) findPreference(getString(R.string.pref_reminders_days_key)); Preference openCalendar = findPreference(getString(R.string.pref_open_calendar_key)); openCalendar.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @SuppressLint("NewApi") @Override public boolean onPreferenceClick(Preference preference) { IntentCall.openCalendarAt(getContext(), new Date()); return true; } }); accountResolver = CalendarAccount.getAccount(getContext()); preferenceCreateCalendar = (TwoStatePreference) findPreference(getString(R.string.pref_create_calendar_key)); preferenceCreateCalendar.setDefaultValue(false); preferenceCreateCalendar.setOnPreferenceClickListener(onPreferenceCalendarClick); preferenceSpecial = (TwoStatePreference) findPreference(getString(R.string.pref_special_service_key)); preferenceSpecial.setDefaultValue(false); if (!BuildConfig.FULL_VERSION) { // Disable switch and show pro dialog if free version preferenceSpecial.setOnPreferenceClickListener(onPreferenceProFeatureClick); } else { preferenceSpecial.setOnPreferenceClickListener(onPreferenceSendSmsClick); } TwoStatePreference preferenceHideInactive = (TwoStatePreference) findPreference(getString(R.string.pref_hide_inactive_features_key)); if (!BuildConfig.FULL_VERSION) { preferenceHideInactive.setOnPreferenceClickListener(onPreferenceProFeatureClick); } }
Example #10
Source File: SettingsActivity.java From stockita-point-of-sale with MIT License | 5 votes |
@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 #11
Source File: SettingsActivity.java From stockita-point-of-sale with MIT License | 5 votes |
@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 #12
Source File: SettingsActivity.java From stockita-point-of-sale with MIT License | 5 votes |
@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 #13
Source File: SettingsActivity.java From video-quickstart-android with MIT License | 5 votes |
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 #14
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 5 votes |
/** * Updates the summary for the preference * * @param preference The preference to be updated * @param value The value that the preference was updated to */ private void setPreferenceSummary(Preference preference, String value) { // COMPLETED (3) Don't forget to add code here to properly set the summary for an EditTextPreference if (preference instanceof ListPreference) { // For list preferences, figure out the label of the selected value ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(value); if (prefIndex >= 0) { // Set the summary to that label listPreference.setSummary(listPreference.getEntries()[prefIndex]); } } else if (preference instanceof EditTextPreference) { preference.setSummary(value); } }
Example #15
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 5 votes |
/** * Updates the summary for the preference * * @param preference The preference to be updated * @param value The value that the preference was updated to */ private void setPreferenceSummary(Preference preference, String value) { if (preference instanceof ListPreference) { // For list preferences, figure out the label of the selected value ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(value); if (prefIndex >= 0) { // Set the summary to that label listPreference.setSummary(listPreference.getEntries()[prefIndex]); } } else if (preference instanceof EditTextPreference) { // For EditTextPreferences, set the summary to the value's simple string representation. preference.setSummary(value); } }
Example #16
Source File: BeaconActionPageFragment.java From beaconloc with Apache License 2.0 | 4 votes |
private String getActionParam1() { EditTextPreference param_name = (EditTextPreference) findPreference("ba_action_param1"); return param_name.getSummary().toString(); }
Example #17
Source File: ChatsPreferenceFragment.java From Silence with GNU General Public License v3.0 | 4 votes |
public TrimLengthValidationListener() { EditTextPreference preference = (EditTextPreference)findPreference(SilencePreferences.THREAD_TRIM_LENGTH); onPreferenceChange(preference, preference.getText()); }
Example #18
Source File: FragmentSettings.java From GPSLogger with GNU General Public License v3.0 | 4 votes |
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()); }
Example #19
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 4 votes |
@Override protected void createPreferences(PreferenceScreen screen) { switch (mAction) { case SettingsConstantsUI.ACTION_PREFS_GENERAL: addPreferencesFromResource(R.xml.preferences_general); final ListPreference theme = (ListPreference) findPreference(SettingsConstantsUI.KEY_PREF_THEME); initializeTheme(getActivity(), theme); final Preference reset = findPreference(SettingsConstantsUI.KEY_PREF_RESET_SETTINGS); initializeReset(getActivity(), reset); break; case SettingsConstantsUI.ACTION_PREFS_MAP: addPreferencesFromResource(R.xml.preferences_map); final ListPreference showInfoPanel = (ListPreference) findPreference( SettingsConstantsUI.KEY_PREF_SHOW_STATUS_PANEL); initializeShowStatusPanel(showInfoPanel); final ListPreference lpCoordinateFormat = (ListPreference) findPreference(SettingsConstantsUI.KEY_PREF_COORD_FORMAT); final IntEditTextPreference etCoordinateFraction = (IntEditTextPreference) findPreference( SettingsConstantsUI.KEY_PREF_COORD_FRACTION); initializeCoordinates(lpCoordinateFormat, etCoordinateFraction); final ListPreference lpUnits = (ListPreference) findPreference(KEY_PREF_UNITS); initializeUnits(lpUnits); final SelectMapPathPreference mapPath = (SelectMapPathPreference) findPreference( SettingsConstants.KEY_PREF_MAP_PATH); mapPath.setOnAttachedListener(this); initializeMapPath(getActivity(), mapPath); final ListPreference showCurrentLocation = (ListPreference) findPreference( SettingsConstantsUI.KEY_PREF_SHOW_CURRENT_LOC); initializeShowCurrentLocation(showCurrentLocation); final ListPreference changeMapBG = (ListPreference) findPreference(SettingsConstantsUI.KEY_PREF_MAP_BG); initializeMapBG(changeMapBG); break; case SettingsConstantsUI.ACTION_PREFS_LOCATION: addPreferencesFromResource(R.xml.preferences_location); final ListPreference lpLocationAccuracy = (ListPreference) findPreference(SettingsConstants.KEY_PREF_LOCATION_SOURCE); initializeLocationAccuracy(lpLocationAccuracy, false); final ListPreference minTimeLoc = (ListPreference) findPreference( SettingsConstants.KEY_PREF_LOCATION_MIN_TIME); final ListPreference minDistanceLoc = (ListPreference) findPreference( SettingsConstants.KEY_PREF_LOCATION_MIN_DISTANCE); initializeLocationMins(minTimeLoc, minDistanceLoc, false); final EditTextPreference accurateMaxCount = (EditTextPreference) findPreference( SettingsConstants.KEY_PREF_LOCATION_ACCURATE_COUNT); initializeAccurateTaking(accurateMaxCount); break; case SettingsConstantsUI.ACTION_PREFS_TRACKING: addPreferencesFromResource(R.xml.preferences_tracks); final ListPreference lpTracksAccuracy = (ListPreference) findPreference(SettingsConstants.KEY_PREF_TRACKS_SOURCE); initializeLocationAccuracy(lpTracksAccuracy, true); final ListPreference minTime = (ListPreference) findPreference(SettingsConstants.KEY_PREF_TRACKS_MIN_TIME); final ListPreference minDistance = (ListPreference) findPreference( SettingsConstants.KEY_PREF_TRACKS_MIN_DISTANCE); initializeLocationMins(minTime, minDistance, true); final CheckBoxPreference uid = (CheckBoxPreference) findPreference(SettingsConstants.KEY_PREF_TRACK_SEND); initializeUid(uid); break; } }