Refactoring

This commit is contained in:
M66B 2021-11-13 08:29:05 +01:00
parent cdaf7cbf54
commit 0b22af992a
2 changed files with 36 additions and 29 deletions

View File

@ -5648,6 +5648,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
continue;
if (i >= message.label_colors.length)
continue;
if (message.label_colors[i] == null)
continue;
int len = ssb.length();
ssb.setSpan(new ForegroundColorSpan(message.label_colors[i]),
@ -5662,21 +5664,26 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return null;
SpannableStringBuilder ssb = new SpannableStringBuilderEx();
if (message.keyword_titles == null || message.keyword_colors == null) {
ssb.append("Keywords missing!");
return ssb;
}
for (int i = 0; i < message.keywords.length; i++) {
if (MessageHelper.showKeyword(message.keywords[i])) {
String keyword = message.keywords[i];
if (MessageHelper.showKeyword(keyword)) {
if (ssb.length() > 0)
ssb.append(' ');
String keyword = message.keyword_titles[i];
if (message.keyword_titles != null &&
i < message.keyword_titles.length &&
message.keyword_titles[i] != null)
keyword = message.keyword_titles[i];
ssb.append(keyword);
if (message.keyword_colors[i] != null) {
if (message.keyword_colors == null)
continue;
if (i >= message.keyword_colors.length)
continue;
if (message.keyword_colors[i] == null)
continue;
int len = ssb.length();
ssb.setSpan(
new ForegroundColorSpan(message.keyword_colors[i]),
@ -5684,7 +5691,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
return ssb;
}

View File

@ -103,6 +103,7 @@ public class TupleMessageEx extends EntityMessage {
List<String> titles = new ArrayList<>();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (this.keywords != null)
for (int i = 0; i < this.keywords.length; i++) {
String keyword = this.keywords[i];