diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml
index 7b2395bf6..ab0d93a49 100644
--- a/xwords4/android/XWords4/res/values/common_rsrc.xml
+++ b/xwords4/android/XWords4/res/values/common_rsrc.xml
@@ -153,9 +153,6 @@
Accept duplicate invites
Accept invitations more than once
- Network connectivity GAINED
- Network connectivity LOST
-
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java
index c4362a615..938166ff1 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java
@@ -60,8 +60,7 @@ import org.eehouse.android.xw4.jni.*;
public class GamesList extends XWExpandableListActivity
implements OnItemLongClickListener,
DBUtils.DBChangeListener, SelectableItem,
- DictImportActivity.DownloadFinishedListener,
- NetStateCache.StateChangedIf {
+ DictImportActivity.DownloadFinishedListener {
private static final int WARN_NODICT = DlgDelegate.DIALOG_LAST + 1;
private static final int WARN_NODICT_SUBST = WARN_NODICT + 1;
@@ -135,7 +134,6 @@ public class GamesList extends XWExpandableListActivity
private GameNamer m_namer;
private long m_launchedGame = DBUtils.ROWID_NOTFOUND;
private boolean m_menuPrepared;
- private boolean m_netAvail;
private HashSet m_selGames;
private HashSet m_selGroupIDs;
private CharSequence m_origTitle;
@@ -375,8 +373,6 @@ public class GamesList extends XWExpandableListActivity
CrashTrack.init( this );
- m_netAvail = NetStateCache.netAvail( this );
-
m_selGames = new HashSet();
m_selGroupIDs = new HashSet();
getBundledData( savedInstanceState );
@@ -417,17 +413,9 @@ public class GamesList extends XWExpandableListActivity
tryStartsFromIntent( intent );
}
- @Override
- protected void onStart()
- {
- super.onStart();
- NetStateCache.register( this, this );
- }
-
@Override
protected void onStop()
{
- NetStateCache.unregister( this, this );
// TelephonyManager mgr =
// (TelephonyManager)getSystemService( Context.TELEPHONY_SERVICE );
// mgr.listen( m_phoneStateListener, PhoneStateListener.LISTEN_NONE );
@@ -956,23 +944,6 @@ public class GamesList extends XWExpandableListActivity
} );
}
- //////////////////////////////////////////////////////////////////////
- // NetStateCache.StateChangedIf
- //////////////////////////////////////////////////////////////////////
- public void netAvail( boolean nowAvailable )
- {
- if ( m_netAvail != nowAvailable ) {
- m_netAvail = nowAvailable;
- if ( BuildConfig.DEBUG ) {
- int id = nowAvailable ?
- R.string.net_change_gained : R.string.net_change_lost;
- Utils.showToast( this, id );
- DbgUtils.logf( "GamesList.netAvail(%s)", getString( id ) );
- }
- GameUtils.resendAllIf( this, false );
- }
- }
-
private void setTitleBar()
{
int fmt = 0;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
index 89651ba3d..a4d978eb0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
@@ -107,7 +107,7 @@ public class NetStateCache {
}
@Override
- public void onReceive( Context context, Intent intent )
+ public void onReceive( final Context context, Intent intent )
{
DbgUtils.assertOnUIThread();
@@ -117,8 +117,6 @@ public class NetStateCache {
NetworkInfo ni = (NetworkInfo)intent.
getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
NetworkInfo.State state = ni.getState();
- DbgUtils.logf( "PvtBroadcastReceiver.onReceive: "
- + "new network state: %s", state.toString() );
boolean netAvail;
switch ( state ) {
@@ -151,15 +149,19 @@ public class NetStateCache {
mNotifyLater = new Runnable() {
@Override
public void run() {
- DbgUtils.logf( "PvtBroadcastReceiver: run() fired." );
Assert.assertTrue( mLastStateSent != s_netAvail );
mLastStateSent = s_netAvail;
+
synchronized( s_ifs ) {
Iterator iter = s_ifs.iterator();
while ( iter.hasNext() ) {
iter.next().netAvail( s_netAvail );
}
}
+
+ if ( s_netAvail ) {
+ GameUtils.resendAllIf( context, false );
+ }
}
};
mHandler.postDelayed( mNotifyLater, WAIT_STABLE_MILLIS );