com.pluscubed.logcat.widget.MultipleChoicePreference Java Examples
The following examples show how to use
com.pluscubed.logcat.widget.MultipleChoicePreference.
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 java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
private void setBufferPreferenceSummary(String value) { String[] commaSeparated = StringUtil.split(StringUtil.nullToEmpty(value), MultipleChoicePreference.DELIMITER); List<CharSequence> checkedEntries = new ArrayList<CharSequence>(); for (String entryValue : commaSeparated) { int idx = ArrayUtil.indexOf(bufferPreference.getEntryValues(), entryValue); checkedEntries.add(bufferPreference.getEntries()[idx]); } String summary = TextUtils.join(getString(R.string.delimiter), checkedEntries); // add the word "simultaneous" to make it clearer what's going on with 2+ buffers if (checkedEntries.size() > 1) { summary += getString(R.string.simultaneous); } bufferPreference.setSummary(summary); }
Example #2
Source File: SettingsActivity.java From javaide with GNU General Public License v3.0 | 6 votes |
private void setBufferPreferenceSummary(String value) { String[] commaSeparated = StringUtil.split(StringUtil.nullToEmpty(value), MultipleChoicePreference.DELIMITER); List<CharSequence> checkedEntries = new ArrayList<CharSequence>(); for (String entryValue : commaSeparated) { int idx = ArrayUtil.indexOf(bufferPreference.getEntryValues(), entryValue); checkedEntries.add(bufferPreference.getEntries()[idx]); } String summary = TextUtils.join(getString(R.string.delimiter), checkedEntries); // add the word "simultaneous" to make it clearer what's going on with 2+ buffers if (checkedEntries.size() > 1) { summary += getString(R.string.simultaneous); } bufferPreference.setSummary(summary); }
Example #3
Source File: SettingsActivity.java From matlog with GNU General Public License v3.0 | 6 votes |
private void setBufferPreferenceSummary(String value) { String[] commaSeparated = StringUtil.split(StringUtil.nullToEmpty(value), MultipleChoicePreference.DELIMITER); List<CharSequence> checkedEntries = new ArrayList<>(); for (String entryValue : commaSeparated) { int idx = ArrayUtil.indexOf(bufferPreference.getEntryValues(), entryValue); checkedEntries.add(bufferPreference.getEntries()[idx]); } String summary = TextUtils.join(getString(R.string.delimiter), checkedEntries); // add the word "simultaneous" to make it clearer what's going on with 2+ buffers if (checkedEntries.size() > 1) { summary += getString(R.string.simultaneous); } bufferPreference.setSummary(summary); }
Example #4
Source File: SettingsActivity.java From java-n-IDE-for-Android with Apache License 2.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 #5
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 #6
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 #7
Source File: PreferenceHelper.java From java-n-IDE-for-Android with Apache License 2.0 | 3 votes |
public static List<String> getBuffers(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); String defaultValue = context.getString(R.string.pref_buffer_choice_main_value); String key = context.getString(R.string.pref_buffer); String value = sharedPrefs.getString(key, defaultValue); return Arrays.asList(StringUtil.split(value, MultipleChoicePreference.DELIMITER)); }
Example #8
Source File: PreferenceHelper.java From javaide with GNU General Public License v3.0 | 3 votes |
public static List<String> getBuffers(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); String defaultValue = context.getString(R.string.pref_buffer_choice_main_value); String key = context.getString(R.string.pref_buffer); String value = sharedPrefs.getString(key, defaultValue); return Arrays.asList(StringUtil.split(value, MultipleChoicePreference.DELIMITER)); }
Example #9
Source File: PreferenceHelper.java From matlog with GNU General Public License v3.0 | 3 votes |
public static List<String> getBuffers(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); String defaultValue = context.getString(R.string.pref_buffer_choice_main_value); String key = context.getString(R.string.pref_buffer); String value = sharedPrefs.getString(key, defaultValue); return Arrays.asList(StringUtil.split(value, MultipleChoicePreference.DELIMITER)); }