1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-29 04:12:18 -05:00

Use TextUtils.concat to concatenate

This commit is contained in:
liato 2011-03-18 01:43:10 +01:00 committed by Sebastian Kaspari
parent 7490cdb38c
commit 92a1e93bc1

View File

@ -29,6 +29,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
import android.widget.TextView; import android.widget.TextView;
@ -228,7 +229,8 @@ public class Message
String nick = hasSender() ? "<" + sender + "> " : ""; String nick = hasSender() ? "<" + sender + "> " : "";
String timestamp = settings.showTimestamp() ? renderTimeStamp(settings.use24hFormat()) : ""; String timestamp = settings.showTimestamp() ? renderTimeStamp(settings.use24hFormat()) : "";
if (settings.showMircColors()) { if (settings.showMircColors()) {
canvas = new SpannableString(prefix + timestamp + nick + MircColors.toSpannable(text)); canvas = new SpannableString(prefix + timestamp + nick);
canvas = new SpannableString(TextUtils.concat(canvas, MircColors.toSpannable(text)));
} }
else { else {
canvas = new SpannableString(prefix + timestamp + nick + MircColors.removeStyleAndColors(text)); canvas = new SpannableString(prefix + timestamp + nick + MircColors.removeStyleAndColors(text));
@ -253,7 +255,6 @@ public class Message
ForegroundColorSpan[] spans = canvas.getSpans(0, canvas.length(), ForegroundColorSpan.class); ForegroundColorSpan[] spans = canvas.getSpans(0, canvas.length(), ForegroundColorSpan.class);
int start = 0; int start = 0;
for (int i = 0; i < spans.length; i++) { for (int i = 0; i < spans.length; i++) {
canvas.getSpanStart(spans[i]);
canvas.setSpan(new ForegroundColorSpan(color), start, canvas.getSpanStart(spans[i]), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); canvas.setSpan(new ForegroundColorSpan(color), start, canvas.getSpanStart(spans[i]), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
start = canvas.getSpanEnd(spans[i]); start = canvas.getSpanEnd(spans[i]);
} }