mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-21 21:22:18 +01:00
DroidFish: Display PGN comments in a color different from PGN moves.
This commit is contained in:
@@ -47,13 +47,14 @@ public class ColorTheme {
|
||||
final static int ARROW_5 = 12;
|
||||
final static int SQUARE_LABEL = 13;
|
||||
final static int DECORATION = 14;
|
||||
private final static int numColors = 15;
|
||||
final static int PGN_COMMENT = 15;
|
||||
private final static int numColors = 16;
|
||||
|
||||
private int colorTable[] = new int[numColors];
|
||||
|
||||
private static final String[] prefNames = {
|
||||
"darkSquare", "brightSquare", "selectedSquare", "cursorSquare", "darkPiece", "brightPiece", "currentMove",
|
||||
"arrow0", "arrow1", "arrow2", "arrow3", "arrow4", "arrow5", "squareLabel", "decoration"
|
||||
"arrow0", "arrow1", "arrow2", "arrow3", "arrow4", "arrow5", "squareLabel", "decoration", "pgnComment"
|
||||
};
|
||||
private static final String prefPrefix = "color_";
|
||||
|
||||
@@ -64,37 +65,37 @@ public class ColorTheme {
|
||||
{ // Original
|
||||
"#FF808080", "#FFBEBE5A", "#FFFF0000", "#FF00FF00", "#FF000000", "#FFFFFFFF", "#FF888888",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF9F9F66"
|
||||
"#FF9F9F66", "#FFC0C000"
|
||||
},
|
||||
{ // XBoard
|
||||
"#FF77A26D", "#FFC8C365", "#FFFFFF00", "#FF00FF00", "#FF202020", "#FFFFFFCC", "#FF6B9262",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF808080"
|
||||
"#FF808080", "#FFC0C000"
|
||||
},
|
||||
{ // Blue
|
||||
"#FF83A5D2", "#FFFFFFFA", "#FF3232D1", "#FF5F5FFD", "#FF282828", "#FFF0F0F0", "#FF3333FF",
|
||||
"#A01F1FFF", "#A01FFF1F", "#501F1FFF", "#501FFF1F", "#1E1F1FFF", "#281FFF1F", "#FFFF0000",
|
||||
"#FF808080"
|
||||
"#FF808080", "#FFC0C000"
|
||||
},
|
||||
{ // Grey
|
||||
"#FF666666", "#FFDDDDDD", "#FFFF0000", "#FF0000FF", "#FF000000", "#FFFFFFFF", "#FF888888",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF909090"
|
||||
"#FF909090", "#FFC0C000"
|
||||
},
|
||||
{ // Scid Default
|
||||
"#FF80A0A0", "#FFD0E0D0", "#FFFF0000", "#FF00FF00", "#FF000000", "#FFFFFFFF", "#FF666666",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF808080"
|
||||
"#FF808080", "#FFC0C000"
|
||||
},
|
||||
{ // Scid Brown
|
||||
"#B58863", "#F0D9B5", "#FFFF0000", "#FF00FF00", "#FF000000", "#FFFFFFFF", "#FF666666",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF808080"
|
||||
"#FF808080", "#FFC0C000"
|
||||
},
|
||||
{ // Scid Green
|
||||
"#FF769656", "#FFEEEED2", "#FFFF0000", "#FF0000FF", "#FF000000", "#FFFFFFFF", "#FF666666",
|
||||
"#A01F1FFF", "#A0FF1F1F", "#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F", "#FFFF0000",
|
||||
"#FF808080"
|
||||
"#FF808080", "#FFC0C000"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.BackgroundColorSpan;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.LeadingMarginSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.TypedValue;
|
||||
@@ -1507,8 +1508,8 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
ColorTheme.instance().setTheme(settings, item);
|
||||
cb.setColors();
|
||||
gameTextListener.setCurrent(gameTextListener.currNode);
|
||||
moveListUpdated();
|
||||
gameTextListener.clear();
|
||||
ctrl.prefsChanged();
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
@@ -2193,7 +2194,11 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
sb.append(' ');
|
||||
}
|
||||
}
|
||||
int l0 = sb.length();
|
||||
sb.append(token.replaceAll("[ \t\r\n]+", " ").trim());
|
||||
int l1 = sb.length();
|
||||
int color = ColorTheme.instance().getColor(ColorTheme.PGN_COMMENT);
|
||||
sb.setSpan(new ForegroundColorSpan(color), l0, l1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
col0 = false;
|
||||
if (nestLevel == 0)
|
||||
newLine();
|
||||
|
||||
Reference in New Issue
Block a user