Keyword improvements

master
M66B 1 week ago
parent 11da34bff4
commit 1d1f087b7a

@ -86,9 +86,11 @@ public class FragmentDialogKeywordManage extends FragmentDialogBase {
String global = prefs.getString("global_keywords", null); String global = prefs.getString("global_keywords", null);
if (global != null) { if (global != null) {
List<String> available = new ArrayList<>(); List<String> available = new ArrayList<>();
available.addAll(Arrays.asList(global.split(" ")));
if (data.available != null) if (data.available != null)
available.addAll(Arrays.asList(data.available)); 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]); data.available = available.toArray(new String[0]);
} }

@ -5229,7 +5229,17 @@ public class FragmentMessages extends FragmentBase
available.add(kw); 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); return new Pair<>(selected, available);
} }

Loading…
Cancel
Save