mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-19 22:26:57 +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()
|
protected void onPause()
|
||||||
{
|
{
|
||||||
m_handler = null;
|
m_handler = null;
|
||||||
|
ConnStatusHandler.setHandler( null );
|
||||||
waitCloseGame( true );
|
waitCloseGame( true );
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
@ -492,6 +493,13 @@ public class BoardActivity extends XWActivity
|
||||||
setKeepScreenOn();
|
setKeepScreenOn();
|
||||||
|
|
||||||
loadGame();
|
loadGame();
|
||||||
|
|
||||||
|
Handler handler = new Handler() {
|
||||||
|
public void handleMessage( Message msg ) {
|
||||||
|
m_view.invalidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ConnStatusHandler.setHandler( handler );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -409,6 +409,8 @@ public class CommsTransport implements TransportProcs,
|
||||||
case COMMS_RELAYSTATE_CONNECT_PENDING:
|
case COMMS_RELAYSTATE_CONNECT_PENDING:
|
||||||
ConnStatusHandler.updateStatusOut( CommsConnType.COMMS_CONN_RELAY,
|
ConnStatusHandler.updateStatusOut( CommsConnType.COMMS_CONN_RELAY,
|
||||||
false );
|
false );
|
||||||
|
ConnStatusHandler.updateStatusIn( CommsConnType.COMMS_CONN_RELAY,
|
||||||
|
false );
|
||||||
break;
|
break;
|
||||||
case COMMS_RELAYSTATE_CONNECTED:
|
case COMMS_RELAYSTATE_CONNECTED:
|
||||||
case COMMS_RELAYSTATE_RECONNECTED:
|
case COMMS_RELAYSTATE_RECONNECTED:
|
||||||
|
|
|
@ -24,6 +24,8 @@ import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
import android.text.format.Time;
|
import android.text.format.Time;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
@ -34,7 +36,7 @@ public class ConnStatusHandler {
|
||||||
private static CommsConnType s_connType = CommsConnType.COMMS_CONN_NONE;
|
private static CommsConnType s_connType = CommsConnType.COMMS_CONN_NONE;
|
||||||
private static Rect s_rect;
|
private static Rect s_rect;
|
||||||
private static boolean s_downOnMe = false;
|
private static boolean s_downOnMe = false;
|
||||||
// private static Object s_syncMe = new Object();
|
private static Handler s_handler;
|
||||||
|
|
||||||
private static class SuccessRecord {
|
private static class SuccessRecord {
|
||||||
// man strftime for these
|
// man strftime for these
|
||||||
|
@ -94,6 +96,11 @@ public class ConnStatusHandler {
|
||||||
s_connType = connType;
|
s_connType = connType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setHandler( Handler handler )
|
||||||
|
{
|
||||||
|
s_handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean handleDown( int xx, int yy )
|
public static boolean handleDown( int xx, int yy )
|
||||||
{
|
{
|
||||||
s_downOnMe = s_rect.contains( xx, yy );
|
s_downOnMe = s_rect.contains( xx, yy );
|
||||||
|
@ -155,12 +162,20 @@ public class ConnStatusHandler {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void invalidateParent()
|
||||||
|
{
|
||||||
|
if ( null != s_handler ) {
|
||||||
|
Message.obtain( s_handler ).sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateStatusIn( CommsConnType connType, boolean success )
|
public static void updateStatusIn( CommsConnType connType, boolean success )
|
||||||
{
|
{
|
||||||
synchronized( s_records ) {
|
synchronized( s_records ) {
|
||||||
SuccessRecord record = recordFor( connType, true );
|
SuccessRecord record = recordFor( connType, true );
|
||||||
record.update( success );
|
record.update( success );
|
||||||
}
|
}
|
||||||
|
invalidateParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateStatusOut( CommsConnType connType, boolean success )
|
public static void updateStatusOut( CommsConnType connType, boolean success )
|
||||||
|
@ -169,6 +184,7 @@ public class ConnStatusHandler {
|
||||||
SuccessRecord record = recordFor( connType, false );
|
SuccessRecord record = recordFor( connType, false );
|
||||||
record.update( success );
|
record.update( success );
|
||||||
}
|
}
|
||||||
|
invalidateParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void draw( Canvas canvas, Resources res,
|
public static void draw( Canvas canvas, Resources res,
|
||||||
|
|
Loading…
Reference in a new issue