show the giving up message as a dialog rather than a toast

This commit is contained in:
Eric House 2012-02-22 14:04:36 -08:00
parent eecc609eae
commit 7a21d4c151
2 changed files with 10 additions and 3 deletions

View file

@ -1872,8 +1872,8 @@
<string name="bt_resendf">Bluetooth send to %1$s failed; retry %3$d in <string name="bt_resendf">Bluetooth send to %1$s failed; retry %3$d in
%2$d seconds.</string> %2$d seconds.</string>
<string name="bt_failf">Giving up on %1$s: Bluetooth send failed <string name="bt_failf">Bluetooth sends to %1$s have failed too many
too many times.</string> times. Re-open the game to try again.</string>
<string name="button_invite">Invite</string> <string name="button_invite">Invite</string>

View file

@ -289,6 +289,7 @@ public class DlgDelegate {
public void eventOccurred( BTService.BTEvent event, final Object ... args ) public void eventOccurred( BTService.BTEvent event, final Object ... args )
{ {
String msg = null; String msg = null;
boolean asToast = true;
switch( event ) { switch( event ) {
case BAD_PROTO: case BAD_PROTO:
msg = Utils.format( m_activity, R.string.bt_bad_protof, msg = Utils.format( m_activity, R.string.bt_bad_protof,
@ -301,6 +302,7 @@ public class DlgDelegate {
case MESSAGE_FAILOUT: case MESSAGE_FAILOUT:
msg = Utils.format( m_activity, R.string.bt_failf, msg = Utils.format( m_activity, R.string.bt_failf,
(String)args[0] ); (String)args[0] );
asToast = false;
break; break;
default: default:
DbgUtils.logf( "eventOccurred: unhandled event %s", event.toString() ); DbgUtils.logf( "eventOccurred: unhandled event %s", event.toString() );
@ -308,10 +310,15 @@ public class DlgDelegate {
if ( null != msg ) { if ( null != msg ) {
final String fmsg = msg; final String fmsg = msg;
final boolean asDlg = !asToast;
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
if ( asDlg ) {
showOKOnlyDialog( fmsg, 0 );
} else {
DbgUtils.showf( m_activity, fmsg ); DbgUtils.showf( m_activity, fmsg );
} }
}
} ); } );
} }
} }