mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +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="change_groupf">Move game %s</string>
|
||||||
|
|
||||||
<string name="show_wordlist_browser">Wordlist browser</string>
|
<string name="show_wordlist_browser">Wordlist browser</string>
|
||||||
|
|
||||||
|
<string name="relay_alert_title">Message from relay</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class GamesList extends XWExpandableListActivity
|
||||||
private static final String ROWID_EXTRA = "rowid";
|
private static final String ROWID_EXTRA = "rowid";
|
||||||
private static final String GAMEID_EXTRA = "gameid";
|
private static final String GAMEID_EXTRA = "gameid";
|
||||||
private static final String REMATCH_ROWID_EXTRA = "rowid_rm";
|
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 NEW_NET_GAME_ACTION = 1;
|
||||||
private static final int RESET_GAME_ACTION = 2;
|
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()
|
private void askDefaultNameIf()
|
||||||
{
|
{
|
||||||
if ( null == CommonPrefs.getDefaultPlayerName( this, 0, false ) ) {
|
if ( null == CommonPrefs.getDefaultPlayerName( this, 0, false ) ) {
|
||||||
|
@ -1109,6 +1118,7 @@ public class GamesList extends XWExpandableListActivity
|
||||||
startNewNetGame( intent );
|
startNewNetGame( intent );
|
||||||
startHasGameID( intent );
|
startHasGameID( intent );
|
||||||
startHasRowID( intent );
|
startHasRowID( intent );
|
||||||
|
tryAlert( intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onGameDictDownload( Context context, Intent intent )
|
public static void onGameDictDownload( Context context, Intent intent )
|
||||||
|
@ -1153,6 +1163,13 @@ public class GamesList extends XWExpandableListActivity
|
||||||
return intent;
|
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 )
|
public static void openGame( Context context, Uri data )
|
||||||
{
|
{
|
||||||
Intent intent = makeSelfIntent( context );
|
Intent intent = makeSelfIntent( context );
|
||||||
|
|
|
@ -494,7 +494,10 @@ public class RelayService extends XWService
|
||||||
break;
|
break;
|
||||||
case XWPDEV_ALERT:
|
case XWPDEV_ALERT:
|
||||||
str = getStringWithLength( dis );
|
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;
|
break;
|
||||||
case XWPDEV_BADREG:
|
case XWPDEV_BADREG:
|
||||||
str = getStringWithLength( dis );
|
str = getStringWithLength( dis );
|
||||||
|
|
|
@ -106,6 +106,11 @@ public class XWExpandableListActivity extends ExpandableListActivity
|
||||||
m_delegate.showOKOnlyDialog( msgID );
|
m_delegate.showOKOnlyDialog( msgID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void showOKOnlyDialog( String msg )
|
||||||
|
{
|
||||||
|
m_delegate.showOKOnlyDialog( msg );
|
||||||
|
}
|
||||||
|
|
||||||
protected void showConfirmThen( String msg, int action )
|
protected void showConfirmThen( String msg, int action )
|
||||||
{
|
{
|
||||||
m_delegate.showConfirmThen( msg, action );
|
m_delegate.showConfirmThen( msg, action );
|
||||||
|
|
Loading…
Reference in a new issue