Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsc <ccccym666@gmail.com>2020-06-06 10:33:33 +0300
committerNiedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com>2020-06-06 11:39:07 +0300
commit36be221948a0661db1571fa55a3c91cbfd351d1d (patch)
tree42eaf960b223ba8cb32cf01d025e1c3a38216b7d /app/src/main
parent566546a1dac6b2d7b6051a99fb55fc3c720d704e (diff)
Remove useless import and add some comments
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java
index 7df1f736..6ae44676 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java
@@ -9,7 +9,6 @@ import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
-import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -65,6 +64,9 @@ public class LoadNotesListTask extends AsyncTask<Void, Void, List<Item>> {
private DBNote colorTheNote(DBNote dbNote) {
if (!TextUtils.isEmpty(searchQuery)) {
SpannableString spannableString = new SpannableString(dbNote.getTitle());
+ // The Pattern.quote method will add \Q to the very beginning of the string and \E to the end of the string
+ // It implies that the string between \Q and \E is a literal string and thus the reserved keyword in such string will be ignored.
+ // See https://stackoverflow.com/questions/15409296/what-is-the-use-of-pattern-quote-method
Matcher matcher = Pattern.compile("(" + Pattern.quote(searchQuery.toString()) + ")", Pattern.CASE_INSENSITIVE).matcher(spannableString);
while (matcher.find()) {
spannableString.setSpan(new ForegroundColorSpan(searchForeground), matcher.start(), matcher.end(), 0);