mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
post notification, not alert, on receipt of relay alert message
This commit is contained in:
parent
0868a33c83
commit
7bce97f78a
4 changed files with 28 additions and 1 deletions
|
@ -2169,4 +2169,6 @@
|
|||
<string name="change_groupf">Move game %s</string>
|
||||
|
||||
<string name="show_wordlist_browser">Wordlist browser</string>
|
||||
|
||||
<string name="relay_alert_title">Message from relay</string>
|
||||
</resources>
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue