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:
parent
2189d2c05f
commit
eea82e506f
@ -22,7 +22,7 @@ package org.yaaic.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.yaaic.utils.Colors;
|
||||
import org.yaaic.utils.MircColors;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@ -228,10 +228,10 @@ public class Message
|
||||
String nick = hasSender() ? "<" + sender + "> " : "";
|
||||
String timestamp = settings.showTimestamp() ? renderTimeStamp(settings.use24hFormat()) : "";
|
||||
if (settings.showMircColors()) {
|
||||
canvas = new SpannableString(prefix + timestamp + nick + Colors.mircColorParserSpannable(text));
|
||||
canvas = new SpannableString(prefix + timestamp + nick + MircColors.toSpannable(text));
|
||||
}
|
||||
else {
|
||||
canvas = new SpannableString(prefix + timestamp + nick + Colors.removeStyleAndColors(text));
|
||||
canvas = new SpannableString(prefix + timestamp + nick + MircColors.removeStyleAndColors(text));
|
||||
}
|
||||
|
||||
if (hasSender()) {
|
||||
|
@ -15,7 +15,7 @@ import android.text.style.StyleSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
|
||||
|
||||
public class Colors {
|
||||
public class MircColors {
|
||||
/*
|
||||
* 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 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
|
||||
@ -54,7 +54,7 @@ public class Colors {
|
||||
* @param text A string with mIRC color codes.
|
||||
* @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);
|
||||
replaceControlCodes(boldPattern.matcher(ssb), ssb, new StyleSpan(Typeface.BOLD));
|
||||
replaceControlCodes(underlinePattern.matcher(ssb), ssb, new UnderlineSpan());
|
Loading…
Reference in New Issue
Block a user