don't show remaining tiles when <= 0

This commit is contained in:
eehouse 2010-04-08 04:12:26 +00:00
parent 97569ae6d0
commit ea07f92b28

View file

@ -301,17 +301,22 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
public void measureRemText( Rect r, int nTilesLeft, int[] width,
int[] height )
{
m_remText = String.format( "%d", nTilesLeft ); // should cache a formatter
m_fillPaint.setTextSize( r.bottom - r.top - 2 );
m_fillPaint.getTextBounds( m_remText, 0, m_remText.length(),
m_boundsScratch );
if ( nTilesLeft > 0 ) {
// should cache a formatter
m_remText = String.format( "%d", nTilesLeft );
m_fillPaint.setTextSize( r.bottom - r.top - 2 );
m_fillPaint.getTextBounds( m_remText, 0, m_remText.length(),
m_boundsScratch );
int minWidth = m_boundsScratch.right;
if ( minWidth < 20 ) {
minWidth = 20; // it's a button; make it bigger
int minWidth = m_boundsScratch.right;
if ( minWidth < 20 ) {
minWidth = 20; // it's a button; make it bigger
}
width[0] = minWidth;
height[0] = m_boundsScratch.bottom;
} else {
width[0] = height[0] = 0;
}
width[0] = minWidth;
height[0] = m_boundsScratch.bottom;
}
public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,