add preference controlling whether bonus "summaries" are shown on top

of bonus squares.
This commit is contained in:
Andy2 2010-07-13 22:39:45 -07:00
parent 7176c7036e
commit 55be90dd12
5 changed files with 22 additions and 3 deletions

View file

@ -13,6 +13,7 @@
<string name="key_ringer_zoom">key_ringer_zoom</string>
<string name="key_click_launches">key_click_launches</string>
<string name="key_hide_title">key_hide_title</string>
<string name="key_show_bonussum">key_show_bonussum</string>
<string name="key_player0">key_clr_player0</string>
<string name="key_player1">key_clr_player1</string>
<string name="key_player2">key_clr_player2</string>

View file

@ -207,6 +207,10 @@
<string name="hide_title_summary">Hiding the game name lets the
board be slightly larger</string>
<string name="show_bonussum">Show bonus values</string>
<string name="show_bonussum_summary">Include text like "2W" on
empty bonus squares</string>
<string name="role_standalone">Standalone</string>
<string name="role_host">Host</string>
<string name="role_guest">Guest</string>

View file

@ -57,6 +57,11 @@
android:summary="@string/hide_title_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_show_bonussum"
android:title="@string/show_bonussum"
android:summary="@string/show_bonussum_summary"
android:defaultValue="true"
/>
<PreferenceScreen android:title="@string/prefs_colors"
android:summary="@string/prefs_colors_summary"
>

View file

@ -47,6 +47,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
private static final int k_miniPaddingV = 2;
private static final float MIN_FONT_DIPS = 14.0f;
private Context m_context;
private Paint m_drawPaint;
private Paint m_fillPaint;
private Paint m_strokePaint;
@ -173,6 +174,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
private void init( Context context )
{
m_context = context;
final float scale = getResources().getDisplayMetrics().density;
m_defaultFontHt = (int)(MIN_FONT_DIPS * scale + 0.5f);
m_mediumFontHt = m_defaultFontHt * 3 / 2;
@ -529,7 +531,9 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
backColor = m_otherColors[CommonPrefs.COLOR_BKGND];
} else {
backColor = m_bonusColors[bonus];
bonusStr = m_bonusSummaries[bonus];
if ( CommonPrefs.getShowBonusSumms(m_context) ) {
bonusStr = m_bonusSummaries[bonus];
}
}
} else if ( pending ) {
backColor = BLACK;
@ -562,8 +566,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
return true;
} // drawCell
public void drawBoardArrow ( Rect rect, int bonus, boolean vert,
int hintAtts, int flags )
public void drawBoardArrow( Rect rect, int bonus, boolean vert,
int hintAtts, int flags )
{
rect.inset( 2, 2 );
Drawable arrow = vert? m_downArrow : m_rightArrow;

View file

@ -222,6 +222,11 @@ public class CommonPrefs {
return getBoolean( context, R.string.key_click_launches, false );
}
public static boolean getShowBonusSumms( Context context )
{
return getBoolean( context, R.string.key_show_bonussum, false );
}
private static boolean getBoolean( Context context, int keyID,
boolean defaultValue )
{