mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
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:
parent
7d573970e0
commit
a6a13bcffd
3 changed files with 25 additions and 3 deletions
|
@ -1869,5 +1869,9 @@
|
||||||
<string name="invite_descf">Please select the %d device[s] you
|
<string name="invite_descf">Please select the %d device[s] you
|
||||||
want to include in this game. Use the Rescan button if you
|
want to include in this game. Use the Rescan button if you
|
||||||
don\'t see a device you expect.</string>
|
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>
|
</resources>
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class BTService extends Service {
|
||||||
, MESSAGE_ACCEPTED
|
, MESSAGE_ACCEPTED
|
||||||
, MESSAGE_REFUSED
|
, MESSAGE_REFUSED
|
||||||
, MESSAGE_NOGAME
|
, MESSAGE_NOGAME
|
||||||
|
, MESSAGE_RESEND
|
||||||
, BT_ENABLED
|
, BT_ENABLED
|
||||||
, BT_DISABLED
|
, BT_DISABLED
|
||||||
};
|
};
|
||||||
|
@ -713,6 +714,10 @@ public class BTService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendResult( evt, elem.m_gameID, 0, elem.m_recipient );
|
sendResult( evt, elem.m_gameID, 0, elem.m_recipient );
|
||||||
|
if ( ! success ) {
|
||||||
|
sendResult( BTEvent.MESSAGE_RESEND,
|
||||||
|
elem.m_recipient, RESEND_TIMEOUT );
|
||||||
|
}
|
||||||
return success;
|
return success;
|
||||||
} // sendMsg
|
} // sendMsg
|
||||||
|
|
||||||
|
|
|
@ -288,15 +288,28 @@ public class DlgDelegate {
|
||||||
|
|
||||||
public void eventOccurred( BTService.BTEvent event, final Object ... args )
|
public void eventOccurred( BTService.BTEvent event, final Object ... args )
|
||||||
{
|
{
|
||||||
|
String msg = null;
|
||||||
switch( event ) {
|
switch( event ) {
|
||||||
case BAD_PROTO:
|
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] );
|
(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;
|
break;
|
||||||
default:
|
default:
|
||||||
DbgUtils.logf( "eventOccurred: unhandled event %s", event.toString() );
|
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()
|
private Dialog createAboutDialog()
|
||||||
|
|
Loading…
Reference in a new issue