1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

Rename Colors class and methods.

This commit is contained in:
liato 2011-03-18 01:30:14 +01:00 committed by Sebastian Kaspari
parent 2189d2c05f
commit eea82e506f
2 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ package org.yaaic.model;
import java.util.Date; import java.util.Date;
import org.yaaic.utils.Colors; import org.yaaic.utils.MircColors;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
@ -228,10 +228,10 @@ 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 + Colors.mircColorParserSpannable(text)); canvas = new SpannableString(prefix + timestamp + nick + MircColors.toSpannable(text));
} }
else { else {
canvas = new SpannableString(prefix + timestamp + nick + Colors.removeStyleAndColors(text)); canvas = new SpannableString(prefix + timestamp + nick + MircColors.removeStyleAndColors(text));
} }
if (hasSender()) { if (hasSender()) {

View File

@ -15,7 +15,7 @@ import android.text.style.StyleSpan;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
public class Colors { public class MircColors {
/* /*
* Colors from the "Classic" theme in mIRC. * Colors from the "Classic" theme in mIRC.
*/ */
@ -45,7 +45,7 @@ public class Colors {
private static final Pattern colorPattern = Pattern.compile("\\x03(\\d{1,2})(?:,(\\d{1,2}))?([^\\x03\\x0F]*)(\\x03|\\x0F)?"); private static final Pattern colorPattern = Pattern.compile("\\x03(\\d{1,2})(?:,(\\d{1,2}))?([^\\x03\\x0F]*)(\\x03|\\x0F)?");
private static final Pattern cleanupPattern = Pattern.compile("(?:\\x02|\\x1F|\\x1D|\\x0F|\\x16|\\x03(?:(?:\\d{1,2})(?:,\\d{1,2})?)?)"); private static final Pattern cleanupPattern = Pattern.compile("(?:\\x02|\\x1F|\\x1D|\\x0F|\\x16|\\x03(?:(?:\\d{1,2})(?:,\\d{1,2})?)?)");
private Colors() {} private MircColors() {}
/** /**
* Converts a string with mIRC style and color codes to a SpannableString with * Converts a string with mIRC style and color codes to a SpannableString with
@ -54,7 +54,7 @@ public class Colors {
* @param text A string with mIRC color codes. * @param text A string with mIRC color codes.
* @return A SpannableString with all the styles applied. * @return A SpannableString with all the styles applied.
*/ */
public static SpannableString mircColorParserSpannable(String text) { public static SpannableString toSpannable(String text) {
SpannableStringBuilder ssb = new SpannableStringBuilder(text); SpannableStringBuilder ssb = new SpannableStringBuilder(text);
replaceControlCodes(boldPattern.matcher(ssb), ssb, new StyleSpan(Typeface.BOLD)); replaceControlCodes(boldPattern.matcher(ssb), ssb, new StyleSpan(Typeface.BOLD));
replaceControlCodes(underlinePattern.matcher(ssb), ssb, new UnderlineSpan()); replaceControlCodes(underlinePattern.matcher(ssb), ssb, new UnderlineSpan());