diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index cdbd49cab..5e24b8c08 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -165,6 +165,7 @@ public class BoardActivity extends XWActivity private int m_missing; private boolean m_haveInvited = false; + private boolean m_overNotShown; private static BoardActivity s_this = null; private static Class s_thisLocker = BoardActivity.class; @@ -500,6 +501,7 @@ public class BoardActivity extends XWActivity Intent intent = getIntent(); m_rowid = intent.getLongExtra( GameUtils.INTENT_KEY_ROWID, -1 ); m_haveInvited = intent.getBooleanExtra( GameUtils.INVITED, false ); + m_overNotShown = true; setBackgroundColor(); setKeepScreenOn(); @@ -692,7 +694,7 @@ public class BoardActivity extends XWActivity } return true; - } + } // onPrepareOptionsMenu public boolean onOptionsItemSelected( MenuItem item ) { @@ -1722,8 +1724,17 @@ public class BoardActivity extends XWActivity if ( 0 != (GameSummary.MSG_FLAGS_CHAT & flags) ) { startChatActivity(); } - if ( 0 != (GameSummary.MSG_FLAGS_GAMEOVER & flags) ) { - m_jniThread.handle( JNICmd.CMD_POST_OVER ); + if ( m_overNotShown ) { + Boolean auto = null; + if ( 0 != (GameSummary.MSG_FLAGS_GAMEOVER & flags) ) { + auto = new Boolean( false ); + } else if ( DBUtils.gameOver( this, m_rowid ) ) { + auto = new Boolean( true ); + } + if ( null != auto ) { + m_overNotShown = false; + m_jniThread.handle( JNICmd.CMD_POST_OVER, auto ); + } } if ( 0 != flags ) { DBUtils.setMsgFlags( m_rowid, GameSummary.MSG_FLAGS_NONE ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java index 24b82e392..3cc42187c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java @@ -524,7 +524,11 @@ public class JNIThread extends Thread { case CMD_POST_OVER: if ( XwJNI.server_getGameIsOver( m_jniGamePtr ) ) { - sendForDialog( R.string.finalscores_title, + boolean auto = 0 < args.length && + ((Boolean)args[0]).booleanValue(); + int titleID = auto? R.string.summary_gameover + : R.string.finalscores_title; + sendForDialog( titleID, XwJNI.server_writeFinalScores( m_jniGamePtr ) ); } break;