diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java index 24ab26a07..67b3d8025 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java @@ -66,6 +66,7 @@ public class GameConfigDelegate extends DelegateBase private static final String INTENT_FORRESULT_NEWGAME = "newgame"; private static final String WHICH_PLAYER = "WHICH_PLAYER"; + private static final String LOCAL_GI = "LOCAL_GI"; private Activity m_activity; private CheckBox m_joinPublicCheck; @@ -530,6 +531,7 @@ public class GameConfigDelegate extends DelegateBase protected void onPause() { + saveChanges(); // save before clearing m_giOrig! m_giOrig = null; // flag for onStart and onResume super.onPause(); if ( null != m_jniThread ) { @@ -541,6 +543,7 @@ public class GameConfigDelegate extends DelegateBase protected void onSaveInstanceState( Bundle outState ) { outState.putInt( WHICH_PLAYER, m_whichPlayer ); + outState.putSerializable( LOCAL_GI, m_gi ); } @Override @@ -666,6 +669,7 @@ public class GameConfigDelegate extends DelegateBase { if ( null != bundle ) { m_whichPlayer = bundle.getInt( WHICH_PLAYER ); + m_gi = (CurGameInfo)bundle.getSerializable( LOCAL_GI ); } } @@ -1152,41 +1156,6 @@ public class GameConfigDelegate extends DelegateBase return 0; } - // private int titleForDlg( int id ) - // { - // switch( id ) { - // // case ROLE_EDIT_RELAY: - // // return R.string.tab_relay; - // // case ROLE_EDIT_SMS: - // // return R.string.tab_sms; - // // case ROLE_EDIT_BT: - // // return R.string.tab_bluetooth; - // } - // Assert.fail(); - // return -1; - // } - - // private String[] makeXportStrings() - // { - // ArrayList strings = new ArrayList(); - // ArrayList types - // = new ArrayList(); - - // strings.add( getString(R.string.tab_relay) ); - // types.add( CommsAddrRec.CommsConnType.COMMS_CONN_RELAY ); - - // if ( m_canDoSMS ) { - // strings.add( getString(R.string.tab_sms) ); - // types.add( CommsAddrRec.CommsConnType.COMMS_CONN_SMS ); - // } - // if ( m_canDoBT ) { - // strings.add( getString(R.string.tab_bluetooth) ); - // types.add( CommsAddrRec.CommsConnType.COMMS_CONN_BT ); - // } - // m_types = types.toArray( new CommsAddrRec.CommsConnType[types.size()] ); - // return strings.toArray( new String[strings.size()] ); - // } - private void saveChanges() { if ( !localOnlyGame() ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java index cee44aa95..0738a19a8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java @@ -35,7 +35,9 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Random; -public class CurGameInfo { +import java.io.Serializable; + +public class CurGameInfo implements Serializable { private static final String TAG = CurGameInfo.class.getSimpleName(); public static final int MAX_NUM_PLAYERS = 4; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java index 7befb6bd2..ea65fe55e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java @@ -22,11 +22,13 @@ package org.eehouse.android.xw4.jni; import android.content.Context; +import java.io.Serializable; + import junit.framework.Assert; import org.eehouse.android.xw4.R; -public class LocalPlayer { +public class LocalPlayer implements Serializable { public String name; public String password; public String dictName;