mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-02 06:20:14 +01:00
inval status icon when there's a change so it gets updated.
This commit is contained in:
parent
10b47257e9
commit
7dfe5ba8e1
3 changed files with 27 additions and 1 deletions
|
@ -478,6 +478,7 @@ public class BoardActivity extends XWActivity
|
|||
protected void onPause()
|
||||
{
|
||||
m_handler = null;
|
||||
ConnStatusHandler.setHandler( null );
|
||||
waitCloseGame( true );
|
||||
super.onPause();
|
||||
}
|
||||
|
@ -492,6 +493,13 @@ public class BoardActivity extends XWActivity
|
|||
setKeepScreenOn();
|
||||
|
||||
loadGame();
|
||||
|
||||
Handler handler = new Handler() {
|
||||
public void handleMessage( Message msg ) {
|
||||
m_view.invalidate();
|
||||
}
|
||||
};
|
||||
ConnStatusHandler.setHandler( handler );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -409,6 +409,8 @@ public class CommsTransport implements TransportProcs,
|
|||
case COMMS_RELAYSTATE_CONNECT_PENDING:
|
||||
ConnStatusHandler.updateStatusOut( CommsConnType.COMMS_CONN_RELAY,
|
||||
false );
|
||||
ConnStatusHandler.updateStatusIn( CommsConnType.COMMS_CONN_RELAY,
|
||||
false );
|
||||
break;
|
||||
case COMMS_RELAYSTATE_CONNECTED:
|
||||
case COMMS_RELAYSTATE_RECONNECTED:
|
||||
|
|
|
@ -24,6 +24,8 @@ import android.content.res.Resources;
|
|||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.format.Time;
|
||||
import java.util.HashMap;
|
||||
import junit.framework.Assert;
|
||||
|
@ -34,7 +36,7 @@ public class ConnStatusHandler {
|
|||
private static CommsConnType s_connType = CommsConnType.COMMS_CONN_NONE;
|
||||
private static Rect s_rect;
|
||||
private static boolean s_downOnMe = false;
|
||||
// private static Object s_syncMe = new Object();
|
||||
private static Handler s_handler;
|
||||
|
||||
private static class SuccessRecord {
|
||||
// man strftime for these
|
||||
|
@ -94,6 +96,11 @@ public class ConnStatusHandler {
|
|||
s_connType = connType;
|
||||
}
|
||||
|
||||
public static void setHandler( Handler handler )
|
||||
{
|
||||
s_handler = handler;
|
||||
}
|
||||
|
||||
public static boolean handleDown( int xx, int yy )
|
||||
{
|
||||
s_downOnMe = s_rect.contains( xx, yy );
|
||||
|
@ -155,12 +162,20 @@ public class ConnStatusHandler {
|
|||
return msg;
|
||||
}
|
||||
|
||||
private static void invalidateParent()
|
||||
{
|
||||
if ( null != s_handler ) {
|
||||
Message.obtain( s_handler ).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateStatusIn( CommsConnType connType, boolean success )
|
||||
{
|
||||
synchronized( s_records ) {
|
||||
SuccessRecord record = recordFor( connType, true );
|
||||
record.update( success );
|
||||
}
|
||||
invalidateParent();
|
||||
}
|
||||
|
||||
public static void updateStatusOut( CommsConnType connType, boolean success )
|
||||
|
@ -169,6 +184,7 @@ public class ConnStatusHandler {
|
|||
SuccessRecord record = recordFor( connType, false );
|
||||
record.update( success );
|
||||
}
|
||||
invalidateParent();
|
||||
}
|
||||
|
||||
public static void draw( Canvas canvas, Resources res,
|
||||
|
|
Loading…
Reference in a new issue