mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-06 05:24:46 +01:00
draw status icon background red when SMS turned off.
This commit is contained in:
parent
bc91956e20
commit
9c670804f2
2 changed files with 20 additions and 6 deletions
|
@ -321,8 +321,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
synchronized( this ) {
|
||||
if ( layoutBoardOnce() ) {
|
||||
canvas.drawBitmap( s_bitmap, 0, 0, m_drawPaint );
|
||||
ConnStatusHandler.draw( canvas, getResources(), 0, 0,
|
||||
m_connType );
|
||||
ConnStatusHandler.draw( m_context, canvas, getResources(),
|
||||
0, 0, m_connType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ public class ConnStatusHandler {
|
|||
showSuccess( handler, false );
|
||||
}
|
||||
|
||||
public static void draw( Canvas canvas, Resources res,
|
||||
public static void draw( Context context, Canvas canvas, Resources res,
|
||||
int offsetX, int offsetY, CommsConnType connType )
|
||||
{
|
||||
synchronized( s_lockObj ) {
|
||||
|
@ -282,16 +282,19 @@ public class ConnStatusHandler {
|
|||
if ( CommsConnType.COMMS_CONN_NONE != connType ) {
|
||||
int saveTop = rect.top;
|
||||
SuccessRecord record;
|
||||
boolean enabled = connTypeEnabled( context, connType );
|
||||
|
||||
// Do the background coloring
|
||||
rect.bottom = rect.top + quarterHeight * 2;
|
||||
record = recordFor( connType, false );
|
||||
s_fillPaint.setColor( record.successNewer ? GREEN : RED );
|
||||
s_fillPaint.setColor( enabled && record.successNewer
|
||||
? GREEN : RED );
|
||||
canvas.drawRect( rect, s_fillPaint );
|
||||
rect.top = rect.bottom;
|
||||
rect.bottom = rect.top + quarterHeight * 2;
|
||||
record = recordFor( connType, true );
|
||||
s_fillPaint.setColor( record.successNewer ? GREEN : RED );
|
||||
s_fillPaint.setColor( enabled && record.successNewer
|
||||
? GREEN : RED );
|
||||
canvas.drawRect( rect, s_fillPaint );
|
||||
|
||||
// now the icons
|
||||
|
@ -458,5 +461,16 @@ public class ConnStatusHandler {
|
|||
s_needsSave = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean connTypeEnabled( Context context,
|
||||
CommsConnType connType )
|
||||
{
|
||||
boolean result = true;
|
||||
switch( connType ) {
|
||||
case COMMS_CONN_SMS:
|
||||
result = XWApp.SMSSUPPORTED && XWPrefs.getSMSEnabled( context );
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue