diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 9524db792..1991df4df 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -2169,4 +2169,6 @@ Move game %s Wordlist browser + + Message from relay 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 a8f4fe089..0fc78f03d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -77,6 +77,7 @@ public class GamesList extends XWExpandableListActivity private static final String ROWID_EXTRA = "rowid"; private static final String GAMEID_EXTRA = "gameid"; private static final String REMATCH_ROWID_EXTRA = "rowid_rm"; + private static final String ALERT_MSG = "alert_msg"; private static final int NEW_NET_GAME_ACTION = 1; private static final int RESET_GAME_ACTION = 2; @@ -1028,6 +1029,14 @@ public class GamesList extends XWExpandableListActivity } } + private void tryAlert( Intent intent ) + { + String msg = intent.getStringExtra( ALERT_MSG ); + if ( null != msg ) { + showOKOnlyDialog( msg ); + } + } + private void askDefaultNameIf() { if ( null == CommonPrefs.getDefaultPlayerName( this, 0, false ) ) { @@ -1109,6 +1118,7 @@ public class GamesList extends XWExpandableListActivity startNewNetGame( intent ); startHasGameID( intent ); startHasRowID( intent ); + tryAlert( intent ); } public static void onGameDictDownload( Context context, Intent intent ) @@ -1153,6 +1163,13 @@ public class GamesList extends XWExpandableListActivity return intent; } + public static Intent makeAlertIntent( Context context, String msg ) + { + Intent intent = makeSelfIntent( context ); + intent.putExtra( ALERT_MSG, msg ); + return intent; + } + public static void openGame( Context context, Uri data ) { Intent intent = makeSelfIntent( context ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index e85ab8aaf..9614ed905 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -494,7 +494,10 @@ public class RelayService extends XWService break; case XWPDEV_ALERT: str = getStringWithLength( dis ); - sendResult( MultiEvent.RELAY_ALERT, str ); + Intent intent = GamesList.makeAlertIntent( this, str ); + Utils.postNotification( this, intent, + R.string.relay_alert_title, + str, str.hashCode() ); break; case XWPDEV_BADREG: str = getStringWithLength( dis ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java index aad00b807..26138c66f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java @@ -106,6 +106,11 @@ public class XWExpandableListActivity extends ExpandableListActivity m_delegate.showOKOnlyDialog( msgID ); } + protected void showOKOnlyDialog( String msg ) + { + m_delegate.showOKOnlyDialog( msg ); + } + protected void showConfirmThen( String msg, int action ) { m_delegate.showConfirmThen( msg, action );