mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
when IS_CURSOR flag is set, use draw using background from prefs.
This commit is contained in:
parent
f0840f1e8d
commit
a067da05db
1 changed files with 34 additions and 10 deletions
|
@ -274,7 +274,9 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
|
public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
|
||||||
boolean focussed )
|
boolean focussed )
|
||||||
{
|
{
|
||||||
m_fillPaint.setColor( m_otherColors[CommonPrefs.COLOR_TILE_BACK] );
|
int indx = focussed ? CommonPrefs.COLOR_FOCUS
|
||||||
|
: CommonPrefs.COLOR_TILE_BACK;
|
||||||
|
m_fillPaint.setColor( m_otherColors[indx] );
|
||||||
m_canvas.drawRect( rOuter, m_fillPaint );
|
m_canvas.drawRect( rOuter, m_fillPaint );
|
||||||
|
|
||||||
m_fillPaint.setColor( BLACK );
|
m_fillPaint.setColor( BLACK );
|
||||||
|
@ -306,6 +308,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
|
|
||||||
public void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi )
|
public void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi )
|
||||||
{
|
{
|
||||||
|
if ( 0 != (dsi.flags & CELL_ISCURSOR) ) {
|
||||||
|
m_fillPaint.setColor( m_otherColors[CommonPrefs.COLOR_FOCUS] );
|
||||||
|
m_canvas.drawRect( rOuter, m_fillPaint );
|
||||||
|
}
|
||||||
String text = m_scores[dsi.playerNum];
|
String text = m_scores[dsi.playerNum];
|
||||||
m_fillPaint.setColor( m_playerColors[dsi.playerNum] );
|
m_fillPaint.setColor( m_playerColors[dsi.playerNum] );
|
||||||
drawCentered( text, rOuter, null );
|
drawCentered( text, rOuter, null );
|
||||||
|
@ -343,7 +349,9 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
|
|
||||||
clearToBack( rect );
|
clearToBack( rect );
|
||||||
|
|
||||||
if ( empty ) {
|
if ( 0 != (flags & CELL_ISCURSOR) ) {
|
||||||
|
backColor = m_otherColors[CommonPrefs.COLOR_FOCUS];
|
||||||
|
} else if ( empty ) {
|
||||||
backColor = m_bonusColors[bonus];
|
backColor = m_bonusColors[bonus];
|
||||||
} else if ( pending ) {
|
} else if ( pending ) {
|
||||||
backColor = BLACK;
|
backColor = BLACK;
|
||||||
|
@ -421,9 +429,18 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
|
|
||||||
public void drawTrayDivider( Rect rect, int flags )
|
public void drawTrayDivider( Rect rect, int flags )
|
||||||
{
|
{
|
||||||
clearToBack( rect );
|
boolean isCursor = 0 != (flags & CELL_ISCURSOR);
|
||||||
m_fillPaint.setColor( BLACK ); // black for now
|
boolean selected = 0 != (flags & CELL_HIGHLIGHT);
|
||||||
m_canvas.drawRect( rect, m_fillPaint );
|
|
||||||
|
int backColor = isCursor? m_otherColors[CommonPrefs.COLOR_FOCUS]:WHITE;
|
||||||
|
fillRect( rect, backColor );
|
||||||
|
|
||||||
|
rect.inset( rect.width()/4, 0 );
|
||||||
|
if ( selected ) {
|
||||||
|
m_canvas.drawRect( rect, m_strokePaint );
|
||||||
|
} else {
|
||||||
|
fillRect( rect, BLACK );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void score_pendingScore( Rect rect, int score, int playerNum,
|
public void score_pendingScore( Rect rect, int score, int playerNum,
|
||||||
|
@ -544,7 +561,9 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
if ( isCursor || notEmpty ) {
|
if ( isCursor || notEmpty ) {
|
||||||
|
|
||||||
if ( clearBack ) {
|
if ( clearBack ) {
|
||||||
m_fillPaint.setColor( m_otherColors[CommonPrefs.COLOR_TILE_BACK]);
|
int indx = isCursor? CommonPrefs.COLOR_FOCUS
|
||||||
|
: CommonPrefs.COLOR_TILE_BACK;
|
||||||
|
m_fillPaint.setColor( m_otherColors[indx] );
|
||||||
m_canvas.drawRect( rect, m_fillPaint );
|
m_canvas.drawRect( rect, m_fillPaint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,8 +590,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
int height = rect.height() - 4; // borders and padding, 2 each
|
int height = rect.height() - 4; // borders and padding, 2 each
|
||||||
descent = fontDims.descentFor( height );
|
descent = fontDims.descentFor( height );
|
||||||
textSize = fontDims.heightFor( height );
|
textSize = fontDims.heightFor( height );
|
||||||
Utils.logf( "using descent: " + descent + " and textSize: "
|
// Utils.logf( "using descent: " + descent + " and textSize: "
|
||||||
+ textSize + " in height " + height );
|
// + textSize + " in height " + height );
|
||||||
}
|
}
|
||||||
int bottom = rect.bottom - descent - 2;
|
int bottom = rect.bottom - descent - 2;
|
||||||
int center = rect.left + ( (rect.right - rect.left) / 2 );
|
int center = rect.left + ( (rect.right - rect.left) / 2 );
|
||||||
|
@ -621,10 +640,15 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillRect( Rect rect, int color )
|
||||||
|
{
|
||||||
|
m_fillPaint.setColor( color );
|
||||||
|
m_canvas.drawRect( rect, m_fillPaint );
|
||||||
|
}
|
||||||
|
|
||||||
private void clearToBack( Rect rect )
|
private void clearToBack( Rect rect )
|
||||||
{
|
{
|
||||||
m_fillPaint.setColor( WHITE );
|
fillRect( rect, WHITE );
|
||||||
m_canvas.drawRect( rect, m_fillPaint );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void figureFontDims()
|
private void figureFontDims()
|
||||||
|
|
Loading…
Reference in a new issue