diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java index b747182f3..a2e6d1a62 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java @@ -49,7 +49,6 @@ public class BoardCanvas extends Canvas implements DrawCtx { private static final String TAG = BoardCanvas.class.getSimpleName(); private static final int BLACK = 0xFF000000; private static final int WHITE = 0xFFFFFFFF; - private static final int LINE_PCT = 3; private static final int SCORE_HT_DROP = 2; private static final boolean DEBUG_DRAWFRAMES = false; private static final int NOT_TURN_ALPHA = 0x3FFFFFFF; @@ -444,7 +443,10 @@ public class BoardCanvas extends Canvas implements DrawCtx { // frame the cell int frameColor = m_otherColors[CommonPrefs.COLOR_CELLLINE]; m_strokePaint.setColor( adjustColor(frameColor) ); - int width = Math.max(1, (rect.width() * LINE_PCT) / 100); + // PENDING: fetch/calculate this a lot less frequently!! + int linePct = XWPrefs.getPrefsInt( m_activity, R.string.key_board_line_pct, 1 ); + linePct = Math.min( 25, linePct ); + int width = Math.max(1, (rect.width() * linePct) / 100); m_strokePaint.setStrokeWidth( width ); drawRect( rect, m_strokePaint ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java index 096b3a3ec..5a61fe028 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java @@ -207,19 +207,21 @@ public class XWPrefs { public static int getPrefsInt( Context context, int keyID, int defaultValue ) { - String key = context.getString( keyID ); - SharedPreferences sp = PreferenceManager - .getDefaultSharedPreferences( context ); - int result; - try { - result = sp.getInt( key, defaultValue ); - // If it's in a pref, it'll be a string (editable) So will get CCE - } catch ( ClassCastException cce ) { - String asStr = sp.getString( key, String.format( "%d", defaultValue ) ); + int result = defaultValue; + if ( null != context ) { + String key = context.getString( keyID ); + SharedPreferences sp = PreferenceManager + .getDefaultSharedPreferences( context ); try { - result = Integer.parseInt( asStr ); - } catch ( Exception ex ) { - result = defaultValue; + result = sp.getInt( key, defaultValue ); + // If it's in a pref, it'll be a string (editable) So will get CCE + } catch ( ClassCastException cce ) { + String asStr = sp.getString( key, String.format( "%d", defaultValue ) ); + try { + result = Integer.parseInt( asStr ); + } catch ( Exception ex ) { + result = defaultValue; + } } } return result; diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml index 45fdb86e9..398eb46e8 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -34,6 +34,7 @@ key_cellline key_clr_crosshairs key_clr_bonushint + key_board_line_pct key_relay_host key_relay_port2 diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index a311ed0c7..d94c925a2 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -850,6 +850,9 @@ Keep screen on Keep board screen on 10 mins + + + Cell line thickness (percent, limit 1 to 25)