Java Code Examples for android.preference.EditTextPreference#setOnPreferenceChangeListener()
The following examples show how to use
android.preference.EditTextPreference#setOnPreferenceChangeListener() .
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: SetupActivity.java From trigger with GNU General Public License v2.0 | 6 votes |
private void setText(String key, String value) { Preference p = findAnyPreference(key, null); if (p instanceof EditTextPreference) { EditTextPreference etp = (EditTextPreference) p; etp.setText(value); // show value as summary etp.setOnPreferenceChangeListener((Preference preference, Object newValue) -> { preference.setSummary(getSummaryValue(key, newValue.toString())); return true; }); etp.setSummary(getSummaryValue(key, value)); } else if (p instanceof ListPreference) { ListPreference lp = (ListPreference) p; lp.setValue(value); // set summary field to "%s" in xml } else { Log.w("SetupActivity.setText", "Cannot find EditTextPreference/ListPreference in PreferenceGroup with key: " + key); } }
Example 2
Source File: SettingFragment.java From SmileEssence with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.setting); EditTextPreference textSizePreference = (EditTextPreference) findPreference(R.string.key_setting_text_size); textSizePreference.setSummary(textSizePreference.getText()); textSizePreference.setOnPreferenceChangeListener(this); ListPreference themePreference = (ListPreference) findPreference(R.string.key_setting_theme); themePreference.setSummary(themePreference.getEntry()); themePreference.setOnPreferenceChangeListener(this); ListPreference namestylePreference = (ListPreference) findPreference(R.string.key_setting_namestyle); namestylePreference.setSummary(namestylePreference.getEntry()); EditTextPreference timelinesPreference = (EditTextPreference) findPreference(R.string.key_setting_timelines); timelinesPreference.setSummary(String.format(getString(R.string.setting_timelines_summary_format), timelinesPreference.getText())); timelinesPreference.setOnPreferenceChangeListener(this); Preference appInfoPreference = findPreference(R.string.key_setting_application_information); appInfoPreference.setOnPreferenceClickListener(this); Preference clearAccount = findPreference(R.string.key_setting_clear_account); clearAccount.setOnPreferenceClickListener(this); Preference license = findPreference(R.string.key_setting_licenses); license.setOnPreferenceClickListener(this); Preference clearConsumer = findPreference(R.string.key_setting_clear_consumer); clearConsumer.setOnPreferenceClickListener(this); appPreferenceHelper = new AppPreferenceHelper(this.getActivity()); }
Example 3
Source File: KrautModule.java From Overchan-Android with GNU General Public License v3.0 | 6 votes |
public void addKompturcodePreference(PreferenceGroup preferenceGroup) { Context context = preferenceGroup.getContext(); EditTextPreference kompturcodePreference = new EditTextPreference(context); kompturcodePreference.setTitle(R.string.kraut_prefs_kompturcode); kompturcodePreference.setDialogTitle(R.string.kraut_prefs_kompturcode); kompturcodePreference.setSummary(R.string.kraut_prefs_kompturcode_summary); kompturcodePreference.setKey(getSharedKey(PREF_KEY_KOMPTURCODE_COOKIE)); kompturcodePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { setKompturcodeCookie((String) newValue); return true; } }); preferenceGroup.addPreference(kompturcodePreference); }
Example 4
Source File: DobroModule.java From Overchan-Android with GNU General Public License v3.0 | 6 votes |
private void addDomainPreferences(PreferenceGroup group) { Context context = group.getContext(); Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) { domain = (String) newValue; if (domain.length() == 0) domain = DEFAULT_DOMAIN; loadHanabiraCookie(); return true; } return false; } }; EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); domainPref.setOnPreferenceChangeListener(updateDomainListener); group.addPreference(domainPref); }
Example 5
Source File: DeviceAdminSample.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Retrieve the useful instance variables mActivity = (DeviceAdminSample) getActivity(); mDPM = mActivity.mDPM; mDeviceAdminSample = mActivity.mDeviceAdminSample; mAdminActive = mActivity.isActiveAdmin(); // Configure the shared UI elements (if they exist) mResetPassword = (EditTextPreference) findPreference(KEY_RESET_PASSWORD); mSetPassword = (PreferenceScreen) findPreference(KEY_SET_PASSWORD); if (mResetPassword != null) { mResetPassword.setOnPreferenceChangeListener(this); } if (mSetPassword != null) { mSetPassword.setOnPreferenceClickListener(this); } }
Example 6
Source File: DeviceAdminSample.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.device_admin_lock_wipe); mLockWipeCategory = (PreferenceCategory) findPreference(KEY_CATEGORY_LOCK_WIPE); mMaxTimeScreenLock = (EditTextPreference) findPreference(KEY_MAX_TIME_SCREEN_LOCK); mMaxFailures = (EditTextPreference) findPreference(KEY_MAX_FAILS_BEFORE_WIPE); mLockScreen = (PreferenceScreen) findPreference(KEY_LOCK_SCREEN); mWipeData = (PreferenceScreen) findPreference(KEY_WIPE_DATA); mWipeAppData = (PreferenceScreen) findPreference(KEY_WIP_DATA_ALL); mMaxTimeScreenLock.setOnPreferenceChangeListener(this); mMaxFailures.setOnPreferenceChangeListener(this); mLockScreen.setOnPreferenceClickListener(this); mWipeData.setOnPreferenceClickListener(this); mWipeAppData.setOnPreferenceClickListener(this); }
Example 7
Source File: SettingsFragment.java From DeviceConnect-Android with MIT License | 5 votes |
/** * Preferenceの設定を有効にします. */ private void enablePreference() { // 設定画面の有効化 getPreferenceScreen().setEnabled(true); // 設定変更イベントの受信開始 mCheckBoxSslPreferences.setOnPreferenceChangeListener(this); EditTextPreference editHostPreferences = (EditTextPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_dconn_host)); editHostPreferences.setOnPreferenceChangeListener(this); EditTextPreference editKeywordPreferences = (EditTextPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_dconn_keyword)); editKeywordPreferences.setOnPreferenceChangeListener(this); EditTextPreference editNamePreferences = (EditTextPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_dconn_name)); editNamePreferences.setOnPreferenceChangeListener(this); mEditPortPreferences.setOnPreferenceChangeListener(this); mCheckBoxOauthPreferences.setOnPreferenceChangeListener(this); mCheckBoxExternalIpPreferences.setOnPreferenceChangeListener(this); mCheckBoxExternalStartAndStartPreferences.setOnPreferenceChangeListener(this); mCheckBoxRequireOriginPreferences.setOnPreferenceChangeListener(this); mCheckBoxOriginBlockingPreferences.setOnPreferenceChangeListener(this); mCheckBoxManagerNameVisiblePreferences.setOnPreferenceChangeListener(this); mObserverPreferences.setOnPreferenceChangeListener(this); mWebPortPreferences.setOnPreferenceChangeListener(this); SwitchPreference serverPreferences = (SwitchPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_dconn_server_on_off)); serverPreferences.setOnPreferenceChangeListener(this); SwitchPreference webPreferences = (SwitchPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_web_server_on_off)); webPreferences.setOnPreferenceChangeListener(this); SwitchPreference eventKeepAlive = (SwitchPreference) getPreferenceScreen() .findPreference(getString(R.string.key_settings_event_keep_alive_on_off)); eventKeepAlive.setOnPreferenceChangeListener(this); }
Example 8
Source File: MakabaModule.java From Overchan-Android with GNU General Public License v3.0 | 5 votes |
/** Добавить категорию настроек домена (в т.ч. https) */ private void addDomainPreferences(PreferenceGroup group) { Context context = group.getContext(); Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) { updateDomain((String) newValue, preferences.getBoolean(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA), true)); return true; } else if (preference.getKey().equals(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA))) { updateDomain(preferences.getString(getSharedKey(PREF_KEY_DOMAIN), DEFAULT_DOMAIN), (boolean)newValue); return true; } return false; } }; PreferenceCategory domainCat = new PreferenceCategory(context); domainCat.setTitle(R.string.makaba_prefs_domain_category); group.addPreference(domainCat); EditTextPreference domainPref = new EditTextPreference(context); //поле ввода домена domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); domainPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(domainPref); CheckBoxPreference httpsPref = new LazyPreferences.CheckBoxPreference(context); //чекбокс "использовать https" httpsPref.setTitle(R.string.pref_use_https); httpsPref.setSummary(R.string.pref_use_https_summary); httpsPref.setKey(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA)); httpsPref.setDefaultValue(true); httpsPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(httpsPref); }
Example 9
Source File: AbstractChanModule.java From Overchan-Android with GNU General Public License v3.0 | 5 votes |
/** * Добавить в группу параметров (на экран/в категорию) новую категорию настроек прокси-сервера * @param group группа, на которую добавляются параметры */ protected void addProxyPreferences(PreferenceGroup group) { final Context context = group.getContext(); PreferenceCategory proxyCat = new PreferenceCategory(context); //категория настроек прокси proxyCat.setTitle(R.string.pref_cat_proxy); group.addPreference(proxyCat); CheckBoxPreference useProxyPref = new LazyPreferences.CheckBoxPreference(context); //чекбокс "использовать ли прокси вообще" useProxyPref.setTitle(R.string.pref_use_proxy); useProxyPref.setSummary(R.string.pref_use_proxy_summary); useProxyPref.setKey(getSharedKey(PREF_KEY_USE_PROXY)); useProxyPref.setDefaultValue(false); useProxyPref.setOnPreferenceChangeListener(updateHttpListener); proxyCat.addPreference(useProxyPref); EditTextPreference proxyHostPref = new LazyPreferences.EditTextPreference(context); //поле ввода адреса прокси-сервера proxyHostPref.setTitle(R.string.pref_proxy_host); proxyHostPref.setDialogTitle(R.string.pref_proxy_host); proxyHostPref.setSummary(R.string.pref_proxy_host_summary); proxyHostPref.setKey(getSharedKey(PREF_KEY_PROXY_HOST)); proxyHostPref.setDefaultValue(DEFAULT_PROXY_HOST); proxyHostPref.getEditText().setSingleLine(); proxyHostPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); proxyHostPref.setOnPreferenceChangeListener(updateHttpListener); proxyCat.addPreference(proxyHostPref); proxyHostPref.setDependency(getSharedKey(PREF_KEY_USE_PROXY)); EditTextPreference proxyHostPort = new LazyPreferences.EditTextPreference(context); //поле ввода порта прокси-сервера proxyHostPort.setTitle(R.string.pref_proxy_port); proxyHostPort.setDialogTitle(R.string.pref_proxy_port); proxyHostPort.setSummary(R.string.pref_proxy_port_summary); proxyHostPort.setKey(getSharedKey(PREF_KEY_PROXY_PORT)); proxyHostPort.setDefaultValue(DEFAULT_PROXY_PORT); proxyHostPort.getEditText().setSingleLine(); proxyHostPort.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER); proxyHostPort.setOnPreferenceChangeListener(updateHttpListener); proxyCat.addPreference(proxyHostPort); proxyHostPort.setDependency(getSharedKey(PREF_KEY_USE_PROXY)); }
Example 10
Source File: SettingsActivity.java From AnkiDroid-Wear with GNU General Public License v2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.activity_settings); NumberPickerPreference fontSizeNumberPicker = (NumberPickerPreference) this.findPreference(getResources().getString(R.string.font_size_key)); NumberPickerPreference screenTimeoutNumberPicker = (NumberPickerPreference) this.findPreference(getResources().getString(R.string.screen_timeout)); EditTextPreference mediaLocationDir = (EditTextPreference) this.findPreference(getResources().getString(R.string.media_folder_location)); if (mediaLocationDir.getText() == null || mediaLocationDir.getText().isEmpty()) { mediaLocationDir.setText(Environment.getExternalStorageDirectory() + "/AnkiDroid/collection.media"); } CardMedia.mediaFolder = mediaLocationDir.getText(); SendToWatchWhenPreferencesChangeListener listener = new SendToWatchWhenPreferencesChangeListener(); fontSizeNumberPicker.setOnPreferenceChangeListener(listener); screenTimeoutNumberPicker.setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.card_flip_animation_key)).setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.double_tap_key)).setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.play_sounds)).setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.ask_before_first_sound)).setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.day_mode)).setOnPreferenceChangeListener(listener); this.findPreference(getResources().getString(R.string.ambient_mode_key)) .setOnPreferenceChangeListener(listener); mediaLocationDir.setOnPreferenceChangeListener(listener); }
Example 11
Source File: DeviceAdminSample.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.device_admin_quality); mQualityCategory = (PreferenceCategory) findPreference(KEY_CATEGORY_QUALITY); mPasswordQuality = (ListPreference) findPreference(KEY_QUALITY); mMinLength = (EditTextPreference) findPreference(KEY_MIN_LENGTH); mMinLetters = (EditTextPreference) findPreference(KEY_MIN_LETTERS); mMinNumeric = (EditTextPreference) findPreference(KEY_MIN_NUMERIC); mMinLowerCase = (EditTextPreference) findPreference(KEY_MIN_LOWER_CASE); mMinUpperCase = (EditTextPreference) findPreference(KEY_MIN_UPPER_CASE); mMinSymbols = (EditTextPreference) findPreference(KEY_MIN_SYMBOLS); mMinNonLetter = (EditTextPreference) findPreference(KEY_MIN_NON_LETTER); mPasswordQuality.setOnPreferenceChangeListener(this); mMinLength.setOnPreferenceChangeListener(this); mMinLetters.setOnPreferenceChangeListener(this); mMinNumeric.setOnPreferenceChangeListener(this); mMinLowerCase.setOnPreferenceChangeListener(this); mMinUpperCase.setOnPreferenceChangeListener(this); mMinSymbols.setOnPreferenceChangeListener(this); mMinNonLetter.setOnPreferenceChangeListener(this); // Finish setup of the quality dropdown mPasswordQuality.setEntryValues(mPasswordQualityValueStrings); }
Example 12
Source File: SettingsActivity.java From WhereAreTheEyes with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); final EditTextPreference username = (EditTextPreference) getPreferenceManager().findPreference("username_preference"); // Set the title to include the username if there is one if( username.getText().length() > 0 ) username.setTitle("Username (" + username.getText() + ")"); // This big block of code is equivalent to s/[^A-Za-z0-9_]//g InputFilter usernameFilter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i < end; i++) { if (!Character.isLetterOrDigit(source.charAt(i)) && source.charAt(i) != '_' ) { return ""; } } return null; } }; username.getEditText().setFilters(new InputFilter[] { usernameFilter }); // Set a callback so we can update the username text when user changes it username.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if( newValue.toString().length() > 0 ) preference.setTitle("Username (" + newValue.toString() + ")"); else preference.setTitle("Username"); Log.d("PREFERENCES", "Updated username to: " + newValue.toString()); return true; // Returning true commits the change } }); Log.d("Settings", "Starting settings."); }
Example 13
Source File: DeviceAdminSample.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.device_admin_expiration); mExpirationCategory = (PreferenceCategory) findPreference(KEY_CATEGORY_EXPIRATION); mHistory = (EditTextPreference) findPreference(KEY_HISTORY); mExpirationTimeout = (EditTextPreference) findPreference(KEY_EXPIRATION_TIMEOUT); mExpirationStatus = (PreferenceScreen) findPreference(KEY_EXPIRATION_STATUS); mHistory.setOnPreferenceChangeListener(this); mExpirationTimeout.setOnPreferenceChangeListener(this); mExpirationStatus.setOnPreferenceClickListener(this); }
Example 14
Source File: PreferencesConnection.java From habpanelviewer with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences_connection); EditTextPreference urlPreference = (EditTextPreference) findPreference(Constants.PREF_SERVER_URL); urlPreference.setOnPreferenceChangeListener(new URLValidatingListener()); }
Example 15
Source File: PreferencesConnected.java From habpanelviewer with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences_connected); EditTextPreference connectedIntervalPreference = (EditTextPreference) findPreference(Constants.PREF_CONNECTED_INTERVAL); connectedIntervalPreference.setOnPreferenceChangeListener(new NumberValidatingListener(0, 6000)); }
Example 16
Source File: TagSettingActivity.java From DeviceConnect-Android with MIT License | 4 votes |
/** * EditTextPreference の summary に値を表示するように設定します. * * @param key EditTextPreference のキー */ private void setEditTextPreferenceSummary(String key) { EditTextPreference pref = (EditTextPreference) getPreferenceScreen().findPreference(key); pref.setSummary(pref.getText()); pref.setOnPreferenceChangeListener(this); }
Example 17
Source File: SettingsActivity.java From matlog with GNU General Public License v3.0 | 4 votes |
private void setUpPreferences() { setCurrentValue("ui.theme"); setCurrentValue("theme"); displayLimitPreference = (EditTextPreference) findPreference(getString(R.string.pref_display_limit)); int displayLimitValue = PreferenceHelper.getDisplayLimitPreference(getActivity()); displayLimitPreference.setSummary(getString(R.string.pref_display_limit_summary, displayLimitValue, getString(R.string.pref_display_limit_default))); displayLimitPreference.setOnPreferenceChangeListener(this); filterPatternPreference = (EditTextPreference) findPreference(getString(R.string.pref_filter_pattern)); filterPatternPreference.setSummary(getString(R.string.pref_filter_pattern_summary)); filterPatternPreference.setOnPreferenceChangeListener(this); logLinePeriodPreference = (EditTextPreference) findPreference(getString(R.string.pref_log_line_period)); int logLinePrefValue = PreferenceHelper.getLogLinePeriodPreference(getActivity()); logLinePeriodPreference.setSummary(getString(R.string.pref_log_line_period_summary, logLinePrefValue, getString(R.string.pref_log_line_period_default))); logLinePeriodPreference.setOnPreferenceChangeListener(this); textSizePreference = (ListPreference) findPreference(getString(R.string.pref_text_size)); textSizePreference.setSummary(textSizePreference.getEntry()); textSizePreference.setOnPreferenceChangeListener(this); defaultLevelPreference = (ListPreference) findPreference(getString(R.string.pref_default_log_level)); defaultLevelPreference.setOnPreferenceChangeListener(this); setDefaultLevelPreferenceSummary(defaultLevelPreference.getEntry()); mThemePreference = findPreference("ui.theme"); mThemePreference.setOnPreferenceChangeListener(this); bufferPreference = (MultipleChoicePreference) findPreference(getString(R.string.pref_buffer)); bufferPreference.setOnPreferenceChangeListener(this); setBufferPreferenceSummary(bufferPreference.getValue()); mThemePreference.setOnPreferenceChangeListener(this); mAboutPreference = findPreference(getString(R.string.pref_about)); mAboutPreference.setOnPreferenceClickListener(preference -> { // launch about activity Intent intent = new Intent(getActivity(), AboutDialogActivity.class); startActivity(intent); return true; }); mAboutPreference.setSummary(getString(R.string.version, PackageHelper.getVersionName(getActivity()))); scrubberPreference = (SwitchPreference) getPreferenceScreen().findPreference("scrubber"); scrubberPreference.setOnPreferenceChangeListener((preference, newValue) -> { LogLine.isScrubberEnabled = (boolean) newValue; return true; }); }
Example 18
Source File: LedSettingsFragment.java From GravityBox with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.led_control_settings); mColorPref = (ColorPickerPreference) findPreference(PREF_KEY_LED_COLOR); mLedOnMsPref = (SeekBarPreference) findPreference(PREF_KEY_LED_TIME_ON); mLedOffMsPref = (SeekBarPreference) findPreference(PREF_KEY_LED_TIME_OFF); mOngoingPref = (CheckBoxPreference) findPreference(PREF_KEY_ONGOING); mNotifSoundOverridePref = (CheckBoxPreference) findPreference(PREF_KEY_NOTIF_SOUND_OVERRIDE); mNotifSoundPref = findPreference(PREF_KEY_NOTIF_SOUND); mSoundReplacePref = (CheckBoxPreference) findPreference(PREF_KEY_NOTIF_SOUND_REPLACE); mNotifSoundOnlyOncePref = (CheckBoxPreference) findPreference(PREF_KEY_NOTIF_SOUND_ONLY_ONCE); mNotifSoundOnlyOnceTimeoutPref = (SeekBarPreference) findPreference(PREF_KEY_NOTIF_SOUND_ONLY_ONCE_TIMEOUT); mNotifInsistentPref = (CheckBoxPreference) findPreference(PREF_KEY_NOTIF_INSISTENT); mVibratePatternOverridePref = (CheckBoxPreference) findPreference(PREF_KEY_VIBRATE_OVERRIDE); mVibratePatternPref = (EditTextPreference) findPreference(PREF_KEY_VIBRATE_PATTERN); mVibratePatternPref.setOnPreferenceChangeListener(this); mVibrateReplacePref = (CheckBoxPreference) findPreference(PREF_KEY_VIBRATE_REPLACE); mDefaultSettingsPref = (SwitchPreference) findPreference(PREF_KEY_DEFAULT_SETTINGS); mActiveScreenCat = (PreferenceCategory) findPreference(PREF_CAT_KEY_ACTIVE_SCREEN); mActiveScreenModePref = (ListPreference) findPreference(PREF_KEY_ACTIVE_SCREEN_MODE); mActiveScreenModePref.setOnPreferenceChangeListener(this); mActiveScreenIgnoreUpdatePref = (CheckBoxPreference) findPreference(PREF_KEY_ACTIVE_SCREEN_IGNORE_UPDATE); mLedModePref = (ListPreference) findPreference(PREF_KEY_LED_MODE); mLedModePref.setOnPreferenceChangeListener(this); mQhCat = (PreferenceCategory) findPreference(PREF_CAT_KEY_QH); mQhIgnorePref = (CheckBoxPreference) findPreference(PREF_KEY_QH_IGNORE); mQhIgnoreListPref = (EditTextPreference) findPreference(PREF_KEY_QH_IGNORE_LIST); mHeadsUpCat = (PreferenceCategory) findPreference(PREF_CAT_KEY_HEADS_UP); mHeadsUpModePref = (ListPreference) findPreference(PREF_KEY_HEADS_UP_MODE); mHeadsUpModePref.setOnPreferenceChangeListener(this); mHeadsUpDndPref = (CheckBoxPreference) findPreference(PREF_KEY_HEADS_UP_DND); mHeadsUpTimeoutPref = (SeekBarPreference) findPreference(PREF_KEY_HEADS_UP_TIMEOUT); mOtherCat = (PreferenceCategory) findPreference(PREF_CAT_KEY_OTHER); mProgressTrackingPref = (CheckBoxPreference) findPreference(PREF_KEY_PROGRESS_TRACKING); mVisibilityPref = (ListPreference) findPreference(PREF_KEY_VISIBILITY); mVisibilityPref.setOnPreferenceChangeListener(this); mVisibilityLsPref = (ListPreference) findPreference(PREF_KEY_VISIBILITY_LS); mVisibilityLsPref.setOnPreferenceChangeListener(this); mDisableSoundToVibratePref = (CheckBoxPreference) findPreference(PREF_KEY_DISABLE_SOUND_TO_VIBRATE); mHidePersistentPref = (CheckBoxPreference) findPreference(PREF_KEY_HIDE_PERSISTENT); mLedDndPref = (MultiSelectListPreference) findPreference(PREF_KEY_LED_DND); mLedIgnoreUpdatePref = (CheckBoxPreference) findPreference(PREF_KEY_LED_IGNORE_UPDATE); }
Example 19
Source File: SettingsActivity.java From javaide with GNU General Public License v3.0 | 4 votes |
private void setUpPreferences() { displayLimitPreference = (EditTextPreference) findPreference(getString(R.string.pref_display_limit)); int displayLimitValue = PreferenceHelper.getDisplayLimitPreference(getActivity()); displayLimitPreference.setSummary(getString(R.string.pref_display_limit_summary, displayLimitValue, getString(R.string.pref_display_limit_default))); displayLimitPreference.setOnPreferenceChangeListener(this); logLinePeriodPreference = (EditTextPreference) findPreference(getString(R.string.pref_log_line_period)); int logLinePrefValue = PreferenceHelper.getLogLinePeriodPreference(getActivity()); logLinePeriodPreference.setSummary(getString(R.string.pref_log_line_period_summary, logLinePrefValue, getString(R.string.pref_log_line_period_default))); logLinePeriodPreference.setOnPreferenceChangeListener(this); textSizePreference = (ListPreference) findPreference(getString(R.string.pref_text_size)); textSizePreference.setSummary(textSizePreference.getEntry()); textSizePreference.setOnPreferenceChangeListener(this); defaultLevelPreference = (ListPreference) findPreference(getString(R.string.pref_default_log_level)); defaultLevelPreference.setOnPreferenceChangeListener(this); setDefaultLevelPreferenceSummary(defaultLevelPreference.getEntry()); bufferPreference = (MultipleChoicePreference) findPreference(getString(R.string.pref_buffer)); bufferPreference.setOnPreferenceChangeListener(this); setBufferPreferenceSummary(bufferPreference.getValue()); scrubberPreference = (SwitchPreference) getPreferenceScreen().findPreference("scrubber"); scrubberPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { LogLine.isScrubberEnabled = (boolean) newValue; return true; } }); }
Example 20
Source File: PickServerFragment.java From android-vlc-remote with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.server_settings); PreferenceScreen preferenceScreen = getPreferenceScreen(); mPreferenceWiFi = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI); mPreferenceButtonFirst = (ListPreference) preferenceScreen.findPreference(Preferences.KEY_BUTTON_FIRST); mPreferenceButtonSecond = (ListPreference) preferenceScreen.findPreference(Preferences.KEY_BUTTON_SECOND); mPreferenceButtonThird = (ListPreference) preferenceScreen.findPreference(Preferences.KEY_BUTTON_THIRD); mPreferenceButtonFourth = (ListPreference) preferenceScreen.findPreference(Preferences.KEY_BUTTON_FOURTH); mPreferenceButtonFifth = (ListPreference) preferenceScreen.findPreference(Preferences.KEY_BUTTON_FIFTH); mProgressCategory = (ProgressCategory) preferenceScreen.findPreference(KEY_SERVERS); CheckBoxPreference preferencePauseForCall = (CheckBoxPreference) preferenceScreen.findPreference(KEY_PAUSE_FOR_CALL); EditTextPreference preferenceSeekTime = (EditTextPreference) preferenceScreen.findPreference(Preferences.KEY_SEEK_TIME); EditTextPreference preferenceAudioDelay = (EditTextPreference) preferenceScreen.findPreference(Preferences.KEY_AUDIO_DELAY); EditTextPreference preferenceSubtitleDelay = (EditTextPreference) preferenceScreen.findPreference(Preferences.KEY_SUBTITLE_DELAY); mPreferenceButtonFirst.setOnPreferenceChangeListener(this); mPreferenceButtonSecond.setOnPreferenceChangeListener(this); mPreferenceButtonThird.setOnPreferenceChangeListener(this); mPreferenceButtonFourth.setOnPreferenceChangeListener(this); mPreferenceButtonFifth.setOnPreferenceChangeListener(this); preferenceAudioDelay.setOnPreferenceChangeListener(this); preferenceSubtitleDelay.setOnPreferenceChangeListener(this); preferenceSeekTime.setOnPreferenceChangeListener(this); preferencePauseForCall.setOnPreferenceChangeListener(this); preferencePauseForCall.setChecked(getPauseForCall()); Intent intent = getActivity().getIntent(); mPort = intent.getIntExtra(PortSweeper.EXTRA_PORT, 0); if (mPort == 0) { throw new IllegalArgumentException("Port must be specified"); } mRemembered = buildRememberedServersMap(Preferences.get(getActivity()).getRememberedServers()); mReceiver = new MyBroadcastReceiver(); setButtonIcons(); updateWifiInfo(); }