mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
use HashSet rather than relying on nesting (which I can't) to track
whether I'm running
This commit is contained in:
parent
34428b3460
commit
a52c18522c
3 changed files with 15 additions and 5 deletions
|
@ -27,21 +27,23 @@ import android.app.AlarmManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.widget.Toast;
|
||||
import android.os.Bundle;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.eehouse.android.xw4.jni.CommonPrefs;
|
||||
|
||||
public class DispatchNotify extends Activity {
|
||||
private static Activity s_running = null;
|
||||
private static HashSet<Activity> s_running = new HashSet<Activity>();
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState )
|
||||
{
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
if ( null == s_running ) {
|
||||
if ( s_running.isEmpty() ) {
|
||||
Utils.logf( "DispatchNotify: nothing running" );
|
||||
startActivity( new Intent( this, GamesList.class ) );
|
||||
} else {
|
||||
Utils.logf( "DispatchNotify: something running" );
|
||||
Intent intent = getIntent();
|
||||
String[] relayIDs =
|
||||
intent.getStringArrayExtra(getString(R.string.relayids_extra));
|
||||
|
@ -58,6 +60,12 @@ public class DispatchNotify extends Activity {
|
|||
|
||||
public static void SetRunning( Activity running )
|
||||
{
|
||||
s_running = running;
|
||||
s_running.add( running );
|
||||
}
|
||||
|
||||
public static void ClearRunning( Activity running )
|
||||
{
|
||||
s_running.remove( running );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class XWActivity extends Activity {
|
|||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
Utils.logf( "XWActivity::onStart()" );
|
||||
super.onStart();
|
||||
DispatchNotify.SetRunning( this );
|
||||
}
|
||||
|
@ -34,7 +35,8 @@ public class XWActivity extends Activity {
|
|||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
Utils.logf( "XWActivity::onStop()" );
|
||||
super.onStop();
|
||||
DispatchNotify.SetRunning( null );
|
||||
DispatchNotify.ClearRunning( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@ public class XWListActivity extends ListActivity {
|
|||
{
|
||||
Utils.logf( "XWListActivity::onStop" );
|
||||
super.onStop();
|
||||
DispatchNotify.SetRunning( null );
|
||||
DispatchNotify.ClearRunning( this );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue