com.pluscubed.logcat.util.StringUtil Java Examples

The following examples show how to use com.pluscubed.logcat.util.StringUtil. 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 vote down vote up
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 vote down vote up
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 vote down vote up
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: LogcatActivity.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private void addToAutocompleteSuggestions(LogLine logLine) {
    // add the tags to the autocompletetextview

    if (!StringUtil.isEmptyOrWhitespaceOnly(logLine.getTag())) {
        String trimmed = logLine.getTag().trim();
        addToAutocompleteSuggestions(trimmed);
    }
}
 
Example #5
Source File: LogcatActivity.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void addToAutocompleteSuggestions(LogLine logLine) {
    // add the tags to the autocompletetextview

    if (!StringUtil.isEmptyOrWhitespaceOnly(logLine.getTag())) {
        String trimmed = logLine.getTag().trim();
        addToAutocompleteSuggestions(trimmed);
    }
}
 
Example #6
Source File: LogcatActivity.java    From matlog with GNU General Public License v3.0 5 votes vote down vote up
private void addToAutocompleteSuggestions(LogLine logLine) {
    // add the tags to the autocompletetextview

    if (!StringUtil.isEmptyOrWhitespaceOnly(logLine.getTag())) {
        String trimmed = logLine.getTag().trim();
        addToAutocompleteSuggestions(trimmed);
    }
}
 
Example #7
Source File: MultipleChoicePreference.java    From matlog with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPrepareDialogBuilder(Builder builder) {

    // convert comma-separated list to boolean array

    String value = getValue();
    Set<String> commaSeparated = new HashSet<>(Arrays.asList(StringUtil.split(value, DELIMITER)));

    CharSequence[] entryValues = getEntryValues();
    final boolean[] checked = new boolean[entryValues.length];
    for (int i = 0; i < entryValues.length; i++) {
        checked[i] = commaSeparated.contains(entryValues[i]);
    }

    builder.setMultiChoiceItems(getEntries(), checked, (dialog, which, isChecked) -> checked[which] = isChecked);
    builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {

        checkedDialogEntryIndexes = checked;

        /*
         * Clicking on an item simulates the positive button
         * click, and dismisses the dialog.
         */
        MultipleChoicePreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
        dialog.dismiss();

    });
}
 
Example #8
Source File: SearchCriteria.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
private boolean checkFoundText(LogLine logLine) {
    return TextUtils.isEmpty(searchText)
            || (searchTextAsInt != -1 && searchTextAsInt == logLine.getProcessId())
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), searchText))
            || (logLine.getLogOutput() != null && StringUtil.containsIgnoreCase(logLine.getLogOutput(), searchText));
}
 
Example #9
Source File: SearchCriteria.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
private boolean checkFoundTag(LogLine logLine) {
    return TextUtils.isEmpty(tag)
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), tag));
}
 
Example #10
Source File: SearchCriteria.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private boolean checkFoundText(LogLine logLine) {
    return TextUtils.isEmpty(searchText)
            || (searchTextAsInt != -1 && searchTextAsInt == logLine.getProcessId())
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), searchText))
            || (logLine.getLogOutput() != null && StringUtil.containsIgnoreCase(logLine.getLogOutput(), searchText));
}
 
Example #11
Source File: SearchCriteria.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private boolean checkFoundTag(LogLine logLine) {
    return TextUtils.isEmpty(tag)
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), tag));
}
 
Example #12
Source File: SearchCriteria.java    From matlog with GNU General Public License v3.0 4 votes vote down vote up
private boolean checkFoundText(LogLine logLine) {
    return TextUtils.isEmpty(searchText)
            || (searchTextAsInt != -1 && searchTextAsInt == logLine.getProcessId())
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), searchText))
            || (logLine.getLogOutput() != null && StringUtil.containsIgnoreCase(logLine.getLogOutput(), searchText));
}
 
Example #13
Source File: SearchCriteria.java    From matlog with GNU General Public License v3.0 4 votes vote down vote up
private boolean checkFoundTag(LogLine logLine) {
    return TextUtils.isEmpty(tag)
            || (logLine.getTag() != null && StringUtil.containsIgnoreCase(logLine.getTag(), tag));
}
 
Example #14
Source File: PreferenceHelper.java    From java-n-IDE-for-Android with Apache License 2.0 3 votes vote down vote up
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 #15
Source File: PreferenceHelper.java    From javaide with GNU General Public License v3.0 3 votes vote down vote up
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 #16
Source File: PreferenceHelper.java    From matlog with GNU General Public License v3.0 3 votes vote down vote up
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));
}