Refactoring

pull/194/merge
M66B 3 years ago
parent cdaf7cbf54
commit 0b22af992a

@ -5648,6 +5648,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
continue; continue;
if (i >= message.label_colors.length) if (i >= message.label_colors.length)
continue; continue;
if (message.label_colors[i] == null)
continue;
int len = ssb.length(); int len = ssb.length();
ssb.setSpan(new ForegroundColorSpan(message.label_colors[i]), ssb.setSpan(new ForegroundColorSpan(message.label_colors[i]),
@ -5662,21 +5664,26 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return null; return null;
SpannableStringBuilder ssb = new SpannableStringBuilderEx(); 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++) { 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) if (ssb.length() > 0)
ssb.append(' '); 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); 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(); int len = ssb.length();
ssb.setSpan( ssb.setSpan(
new ForegroundColorSpan(message.keyword_colors[i]), new ForegroundColorSpan(message.keyword_colors[i]),
@ -5684,7 +5691,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
} }
}
return ssb; return ssb;
} }

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

Loading…
Cancel
Save