Skip to content

Commit

Permalink
Keyword improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Nov 8, 2024
1 parent 11da34b commit 1d1f087
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ public void onChanged(TupleKeyword.Persisted data) {
String global = prefs.getString("global_keywords", null);
if (global != null) {
List<String> available = new ArrayList<>();
available.addAll(Arrays.asList(global.split(" ")));
if (data.available != null)
available.addAll(Arrays.asList(data.available));
for (String kw : global.split(" "))
if (!available.contains(kw))
available.add(kw);
data.available = available.toArray(new String[0]);
}

Expand Down
12 changes: 11 additions & 1 deletion app/src/main/java/eu/faircode/email/FragmentMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -5229,7 +5229,17 @@ protected Pair<List<String>, List<String>> onExecute(Context context, Bundle arg
available.add(kw);
}

Collections.sort(available);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String global = prefs.getString("global_keywords", null);
if (global != null)
for (String kw : global.split(" "))
if (!available.contains(kw))
available.add(kw);

final Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc

Collections.sort(available, collator);

return new Pair<>(selected, available);
}
Expand Down

0 comments on commit 1d1f087

Please sign in to comment.