mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
add preference to set cell line thickness
This commit is contained in:
parent
725bec1a7a
commit
fcc2beb857
5 changed files with 29 additions and 14 deletions
|
@ -49,7 +49,6 @@ 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 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;
|
||||||
|
@ -444,7 +443,10 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
// frame the cell
|
// frame the cell
|
||||||
int frameColor = m_otherColors[CommonPrefs.COLOR_CELLLINE];
|
int frameColor = m_otherColors[CommonPrefs.COLOR_CELLLINE];
|
||||||
m_strokePaint.setColor( adjustColor(frameColor) );
|
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 );
|
m_strokePaint.setStrokeWidth( width );
|
||||||
drawRect( rect, m_strokePaint );
|
drawRect( rect, m_strokePaint );
|
||||||
|
|
||||||
|
|
|
@ -207,19 +207,21 @@ public class XWPrefs {
|
||||||
|
|
||||||
public static int getPrefsInt( Context context, int keyID, int defaultValue )
|
public static int getPrefsInt( Context context, int keyID, int defaultValue )
|
||||||
{
|
{
|
||||||
String key = context.getString( keyID );
|
int result = defaultValue;
|
||||||
SharedPreferences sp = PreferenceManager
|
if ( null != context ) {
|
||||||
.getDefaultSharedPreferences( context );
|
String key = context.getString( keyID );
|
||||||
int result;
|
SharedPreferences sp = PreferenceManager
|
||||||
try {
|
.getDefaultSharedPreferences( context );
|
||||||
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 {
|
try {
|
||||||
result = Integer.parseInt( asStr );
|
result = sp.getInt( key, defaultValue );
|
||||||
} catch ( Exception ex ) {
|
// If it's in a pref, it'll be a string (editable) So will get CCE
|
||||||
result = defaultValue;
|
} catch ( ClassCastException cce ) {
|
||||||
|
String asStr = sp.getString( key, String.format( "%d", defaultValue ) );
|
||||||
|
try {
|
||||||
|
result = Integer.parseInt( asStr );
|
||||||
|
} catch ( Exception ex ) {
|
||||||
|
result = defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<string name="key_cellline">key_cellline</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>
|
||||||
|
<string name="key_board_line_pct">key_board_line_pct</string>
|
||||||
|
|
||||||
<string name="key_relay_host">key_relay_host</string>
|
<string name="key_relay_host">key_relay_host</string>
|
||||||
<string name="key_relay_port">key_relay_port2</string>
|
<string name="key_relay_port">key_relay_port2</string>
|
||||||
|
|
|
@ -850,6 +850,9 @@
|
||||||
<string name="keep_screenon">Keep screen on</string>
|
<string name="keep_screenon">Keep screen on</string>
|
||||||
<!-- clarification of above -->
|
<!-- clarification of above -->
|
||||||
<string name="keep_screenon_summary">Keep board screen on 10 mins</string>
|
<string name="keep_screenon_summary">Keep board screen on 10 mins</string>
|
||||||
|
|
||||||
|
<!-- Preference title: cell line thickness as pct of cell width -->
|
||||||
|
<string name="board_line_pct">Cell line thickness (percent, limit 1 to 25)</string>
|
||||||
<!--
|
<!--
|
||||||
############################################################
|
############################################################
|
||||||
# :Screens:
|
# :Screens:
|
||||||
|
|
|
@ -249,6 +249,13 @@
|
||||||
/>
|
/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<org.eehouse.android.xw4.XWEditTextPreference
|
||||||
|
android:key="@string/key_board_line_pct"
|
||||||
|
android:title="@string/board_line_pct"
|
||||||
|
android:defaultValue="1"
|
||||||
|
android:numeric="decimal"
|
||||||
|
/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<PreferenceScreen android:title="@string/prefs_behavior"
|
<PreferenceScreen android:title="@string/prefs_behavior"
|
||||||
|
|
Loading…
Reference in a new issue