diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 4b10a89c9..b34fe200c 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -23,6 +23,7 @@ key_clr_bonus_w3x key_clr_tile_back key_clr_empty + key_clr_background key_clr_crosshairs key_relay_host key_relay_port2 diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 7176cfa15..4c491dc6e 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -293,6 +293,7 @@ Tile background Empty cell/background Crosshairs color + Board background For debugging You should never need these... diff --git a/xwords4/android/XWords4/res/xml/xwprefs.xml b/xwords4/android/XWords4/res/xml/xwprefs.xml index 877f2c692..decbef929 100644 --- a/xwords4/android/XWords4/res/xml/xwprefs.xml +++ b/xwords4/android/XWords4/res/xml/xwprefs.xml @@ -129,6 +129,12 @@ android:title="@string/empty" android:defaultValue="0xFFFFFF" /> + + diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java index 52a1895de..d09ba5b62 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java @@ -318,7 +318,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, synchronized( this ) { if ( null != m_canvas ) { if ( 0 == resID ) { - fillRect( rect, m_otherColors[CommonPrefs.COLOR_BKGND] ); + fillRectOther( rect, CommonPrefs.COLOR_BACKGRND ); } else { Drawable icon = getResources().getDrawable( resID ); icon.setBounds( rect ); @@ -332,7 +332,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, public boolean scoreBegin( Rect rect, int numPlayers, int[] scores, int remCount, int dfs ) { - fillRect( rect, WHITE ); + fillRectOther( rect, CommonPrefs.COLOR_BACKGRND ); m_canvas.save( Canvas.CLIP_SAVE_FLAG ); m_canvas.clipRect(rect); m_scores = new String[numPlayers][]; @@ -365,7 +365,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, { int indx = focussed ? CommonPrefs.COLOR_FOCUS : CommonPrefs.COLOR_TILE_BACK; - fillRect( rOuter, m_otherColors[indx] ); + fillRectOther( rOuter, indx ); m_fillPaint.setColor( BLACK ); drawCentered( m_remText, rInner, null ); @@ -416,7 +416,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, public void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi ) { if ( 0 != (dsi.flags & CELL_ISCURSOR) ) { - fillRect( rOuter, m_otherColors[CommonPrefs.COLOR_FOCUS] ); + fillRectOther( rOuter, CommonPrefs.COLOR_FOCUS ); } String[] texts = m_scores[dsi.playerNum]; m_fillPaint.setColor( m_playerColors[dsi.playerNum] ); @@ -440,7 +440,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, String time = String.format( "%s%d:%02d", negSign, secondsLeft/60, secondsLeft%60 ); - fillRect( rect, WHITE ); + fillRectOther( rect, CommonPrefs.COLOR_BACKGRND ); m_fillPaint.setColor( m_playerColors[player] ); Rect shorter = new Rect( rect ); @@ -476,7 +476,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, backColor = m_otherColors[CommonPrefs.COLOR_FOCUS]; } else if ( empty ) { if ( 0 == bonus ) { - backColor = m_otherColors[CommonPrefs.COLOR_BKGND]; + backColor = m_otherColors[CommonPrefs.COLOR_NOTILE]; } else { backColor = m_bonusColors[bonus]; bonusStr = m_bonusSummaries[bonus]; @@ -606,9 +606,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler, int flags ) { String text = score >= 0? String.format( "%d", score ) : "??"; + int otherIndx = (0 == (flags & CELL_ISCURSOR)) + ? CommonPrefs.COLOR_BACKGRND : CommonPrefs.COLOR_FOCUS; ++rect.top; - fillRect( rect, (0 == (flags & CELL_ISCURSOR)) - ? WHITE : m_otherColors[CommonPrefs.COLOR_FOCUS] ); + fillRectOther( rect, otherIndx ); m_fillPaint.setColor( m_playerColors[playerNum] ); rect.bottom -= rect.height() / 2; @@ -727,7 +728,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, m_canvas.clipRect( rect ); if ( clearBack ) { - fillRect( rect, WHITE ); + fillRectOther( rect, CommonPrefs.COLOR_BACKGRND ); } if ( isCursor || notEmpty ) { @@ -844,6 +845,11 @@ public class BoardView extends View implements DrawCtx, BoardHandler, } } + private void fillRectOther( Rect rect, int index ) + { + fillRect( rect, m_otherColors[index] ); + } + private void fillRect( Rect rect, int color ) { m_fillPaint.setColor( color ); @@ -937,7 +943,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, private boolean darkOnLight() { - int background = m_otherColors[ CommonPrefs.COLOR_BKGND ]; + int background = m_otherColors[ CommonPrefs.COLOR_NOTILE ]; if ( background != m_backgroundUsed ) { m_backgroundUsed = background; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java index a19a3fd64..9daba8308 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java @@ -33,9 +33,10 @@ import org.eehouse.android.xw4.GameUtils; public class CommonPrefs { public static final int COLOR_TILE_BACK = 0; - public static final int COLOR_BKGND = 1; + public static final int COLOR_NOTILE = 1; public static final int COLOR_FOCUS = 2; - public static final int COLOR_LAST = 3; + public static final int COLOR_BACKGRND = 3; + public static final int COLOR_LAST = 4; private static CommonPrefs s_cp = null; @@ -99,6 +100,7 @@ public class CommonPrefs { int idsOther[] = { R.string.key_tile_back, R.string.key_empty, R.string.key_clr_crosshairs, + R.string.key_background, }; for ( int ii = 0; ii < idsOther.length; ++ii ) { otherColors[ii] = prefToColor( context, sp, idsOther[ii] );