add new BTEvent to tell UI that a message will be resent, and in UI

put up a toast naming the unavailable device.  Might want a backoff on
this....
This commit is contained in:
Eric House 2012-02-15 18:55:58 -08:00
parent 7d573970e0
commit a6a13bcffd
3 changed files with 25 additions and 3 deletions

View file

@ -1869,5 +1869,9 @@
<string name="invite_descf">Please select the %d device[s] you
want to include in this game. Use the Rescan button if you
don\'t see a device you expect.</string>
<string name="bt_resendf">Bluetooth send to %1$s failed; retrying in
%2$d seconds.</string>
</resources>

View file

@ -57,6 +57,7 @@ public class BTService extends Service {
, MESSAGE_ACCEPTED
, MESSAGE_REFUSED
, MESSAGE_NOGAME
, MESSAGE_RESEND
, BT_ENABLED
, BT_DISABLED
};
@ -713,6 +714,10 @@ public class BTService extends Service {
}
sendResult( evt, elem.m_gameID, 0, elem.m_recipient );
if ( ! success ) {
sendResult( BTEvent.MESSAGE_RESEND,
elem.m_recipient, RESEND_TIMEOUT );
}
return success;
} // sendMsg

View file

@ -288,15 +288,28 @@ public class DlgDelegate {
public void eventOccurred( BTService.BTEvent event, final Object ... args )
{
String msg = null;
switch( event ) {
case BAD_PROTO:
String msg = Utils.format( m_activity, R.string.bt_bad_protof,
msg = Utils.format( m_activity, R.string.bt_bad_protof,
(String)args[0] );
DbgUtils.showf( m_activity, msg );
break;
case MESSAGE_RESEND:
msg = Utils.format( m_activity, R.string.bt_resendf,
(String)args[0], (Long)args[1] );
break;
default:
DbgUtils.logf( "eventOccurred: unhandled event %s", event.toString() );
}
if ( null != msg ) {
final String fmsg = msg;
post( new Runnable() {
public void run() {
DbgUtils.showf( m_activity, fmsg );
}
} );
}
}
private Dialog createAboutDialog()