Java Code Examples for com.pluscubed.logcat.util.StringUtil

The following examples show how to use com.pluscubed.logcat.util.StringUtil. These examples are extracted from open source projects. 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 Project: java-n-IDE-for-Android   Source File: SettingsActivity.java    License: 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 Project: javaide   Source File: SettingsActivity.java    License: 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 Project: matlog   Source File: SettingsActivity.java    License: 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 Project: java-n-IDE-for-Android   Source File: LogcatActivity.java    License: 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 Project: javaide   Source File: LogcatActivity.java    License: 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 Project: matlog   Source File: LogcatActivity.java    License: 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
@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 Project: java-n-IDE-for-Android   Source File: SearchCriteria.java    License: 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 Project: java-n-IDE-for-Android   Source File: SearchCriteria.java    License: 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 Project: javaide   Source File: SearchCriteria.java    License: 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 Project: javaide   Source File: SearchCriteria.java    License: 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 Project: matlog   Source File: SearchCriteria.java    License: 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 Project: matlog   Source File: SearchCriteria.java    License: 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 Project: java-n-IDE-for-Android   Source File: PreferenceHelper.java    License: 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 Project: javaide   Source File: PreferenceHelper.java    License: 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 Project: matlog   Source File: PreferenceHelper.java    License: 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));
}