mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
add preference to set cell line thickness
This commit is contained in:
parent
ad4542b4ac
commit
982200cb3b
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 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 );
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<string name="key_cellline">key_cellline</string>
|
||||
<string name="key_clr_crosshairs">key_clr_crosshairs</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_port">key_relay_port2</string>
|
||||
|
|
|
@ -850,6 +850,9 @@
|
|||
<string name="keep_screenon">Keep screen on</string>
|
||||
<!-- clarification of above -->
|
||||
<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:
|
||||
|
|
|
@ -249,6 +249,13 @@
|
|||
/>
|
||||
</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 android:title="@string/prefs_behavior"
|
||||
|
|
Loading…
Reference in a new issue