add pref to set color of board lines

This commit is contained in:
Eric House 2020-07-19 17:31:50 -07:00
parent 729fb5d6b7
commit ad4542b4ac
6 changed files with 20 additions and 4 deletions

View file

@ -49,7 +49,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
private static final String TAG = BoardCanvas.class.getSimpleName(); private static final String TAG = BoardCanvas.class.getSimpleName();
private static final int BLACK = 0xFF000000; private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF; private static final int WHITE = 0xFFFFFFFF;
private static final int FRAME_GREY = 0xFF101010; private static final int LINE_PCT = 3;
private static final int SCORE_HT_DROP = 2; private static final int SCORE_HT_DROP = 2;
private static final boolean DEBUG_DRAWFRAMES = false; private static final boolean DEBUG_DRAWFRAMES = false;
private static final int NOT_TURN_ALPHA = 0x3FFFFFFF; private static final int NOT_TURN_ALPHA = 0x3FFFFFFF;
@ -442,7 +442,10 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
// frame the cell // frame the cell
m_strokePaint.setColor( adjustColor(FRAME_GREY) ); int frameColor = m_otherColors[CommonPrefs.COLOR_CELLLINE];
m_strokePaint.setColor( adjustColor(frameColor) );
int width = Math.max(1, (rect.width() * LINE_PCT) / 100);
m_strokePaint.setStrokeWidth( width );
drawRect( rect, m_strokePaint ); drawRect( rect, m_strokePaint );
drawCrosshairs( rect, flags ); drawCrosshairs( rect, flags );
@ -559,7 +562,8 @@ public class BoardCanvas extends Canvas implements DrawCtx {
// the board (without scrolling), the right-most cells // the board (without scrolling), the right-most cells
// don't draw their right borders due to clipping, so draw // don't draw their right borders due to clipping, so draw
// for them. // for them.
m_strokePaint.setColor( adjustColor(FRAME_GREY) ); int frameColor = m_otherColors[CommonPrefs.COLOR_CELLLINE];
m_strokePaint.setColor( adjustColor(frameColor) );
int xx = rect.left + rect.width() - 1; int xx = rect.left + rect.width() - 1;
drawLine( xx, rect.top, xx, rect.top + rect.height(), drawLine( xx, rect.top, xx, rect.top + rect.height(),
m_strokePaint ); m_strokePaint );

View file

@ -102,6 +102,7 @@ public class PrefsDelegate extends DelegateBase
R.string.key_empty, R.string.key_empty,
R.string.key_background, R.string.key_background,
R.string.key_clr_bonushint, R.string.key_clr_bonushint,
R.string.key_cellline,
}; };
for ( int colorKey : colorKeys ) { for ( int colorKey : colorKeys ) {
editor.remove( getString(colorKey) ); editor.remove( getString(colorKey) );

View file

@ -40,7 +40,8 @@ public class CommonPrefs extends XWPrefs {
public static final int COLOR_FOCUS = 2; public static final int COLOR_FOCUS = 2;
public static final int COLOR_BACKGRND = 3; public static final int COLOR_BACKGRND = 3;
public static final int COLOR_BONUSHINT = 4; public static final int COLOR_BONUSHINT = 4;
public static final int COLOR_LAST = 5; public static final int COLOR_CELLLINE = 5;
public static final int COLOR_LAST = 6;
private static CommonPrefs s_cp = null; private static CommonPrefs s_cp = null;
@ -108,6 +109,7 @@ public class CommonPrefs extends XWPrefs {
R.string.key_clr_crosshairs, R.string.key_clr_crosshairs,
R.string.key_background, R.string.key_background,
R.string.key_clr_bonushint, R.string.key_clr_bonushint,
R.string.key_cellline,
}; };
for ( int ii = 0; ii < idsOther.length; ++ii ) { for ( int ii = 0; ii < idsOther.length; ++ii ) {
otherColors[ii] = prefToColor( context, sp, idsOther[ii] ); otherColors[ii] = prefToColor( context, sp, idsOther[ii] );

View file

@ -31,6 +31,7 @@
<string name="key_tile_back">key_clr_tile_back</string> <string name="key_tile_back">key_clr_tile_back</string>
<string name="key_empty">key_clr_empty</string> <string name="key_empty">key_clr_empty</string>
<string name="key_background">key_clr_background</string> <string name="key_background">key_clr_background</string>
<string name="key_cellline">key_cellline</string>
<string name="key_clr_crosshairs">key_clr_crosshairs</string> <string name="key_clr_crosshairs">key_clr_crosshairs</string>
<string name="key_clr_bonushint">key_clr_bonushint</string> <string name="key_clr_bonushint">key_clr_bonushint</string>

View file

@ -889,6 +889,8 @@
<!-- the color of text, e.g. "2L", shown on a bonus square on the <!-- the color of text, e.g. "2L", shown on a bonus square on the
board --> board -->
<string name="key_bonushint">In-square bonus hint</string> <string name="key_bonushint">In-square bonus hint</string>
<!-- The color of the lines delimiting cells on the board -->
<string name="cellline">Board lines</string>
<!-- <!--
############################################################ ############################################################
# :Dialogs: # :Dialogs:

View file

@ -241,6 +241,12 @@
android:title="@string/background" android:title="@string/background"
android:defaultValue="0xFFFFFF" android:defaultValue="0xFFFFFF"
/> />
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_cellline"
android:title="@string/cellline"
android:defaultValue="0x101010"
/>
</PreferenceScreen> </PreferenceScreen>
</PreferenceScreen> </PreferenceScreen>