Add option to remove relay from a game once it's been turned off.

This commit is contained in:
Eric House 2016-06-26 15:53:26 -07:00
parent 3d682c425f
commit 3bc60c59d0
7 changed files with 318 additions and 278 deletions

File diff suppressed because it is too large Load diff

View file

@ -2103,10 +2103,14 @@
Bluetooth now, or later.
</string>
<string name="warn_relay_disabled">Relay play is currently disable on
this device. No moves will be sent or received via the
relay.\n\nYou can enable relay play now, or later.
</string>
<string name="warn_relay_disabled">Relay play is currently disable
on this device. No moves will be sent or received via the
relay. </string>
<string name="warn_relay_later">You can enable relay play now, or
later.</string>
<string name="warn_relay_remove">You can enable relay play now, or
remove it from this game.</string>
<string name="warn_relay_havegames">Are you sure you want to
disable play using the relay?</string>

View file

@ -1822,10 +1822,13 @@
ecived. On sevom lliw eb tnes aiv Htooteulb.\n\nUoy nac elbane
Htooteulb ,won ro retal.
</string>
<string name="warn_relay_disabled">Yaler yalp si yltnerruc elbasid no
siht ecived. On sevom lliw eb tnes ro deviecer aiv eht
yaler.\n\nUoy nac elbane yaler yalp ,won ro retal.
</string>
<string name="warn_relay_disabled">Yaler yalp si yltnerruc elbasid
no siht ecived. On sevom lliw eb tnes ro deviecer aiv eht
yaler. </string>
<string name="warn_relay_later">Uoy nac elbane yaler yalp ,won ro
retal.</string>
<string name="warn_relay_remove">Uoy nac elbane yaler yalp ,won ro
evomer ti morf siht emag.</string>
<string name="warn_relay_havegames">Era uoy erus uoy tnaw ot
elbasid yalp gnisu eht ?yaler</string>
<plurals name="warn_relay_games_fmt">

View file

@ -1822,10 +1822,13 @@
DEVICE. NO MOVES WILL BE SENT VIA BLUETOOTH.\n\nYOU CAN ENABLE
BLUETOOTH NOW, OR LATER.
</string>
<string name="warn_relay_disabled">RELAY PLAY IS CURRENTLY DISABLE ON
THIS DEVICE. NO MOVES WILL BE SENT OR RECEIVED VIA THE
RELAY.\n\nYOU CAN ENABLE RELAY PLAY NOW, OR LATER.
</string>
<string name="warn_relay_disabled">RELAY PLAY IS CURRENTLY DISABLE
ON THIS DEVICE. NO MOVES WILL BE SENT OR RECEIVED VIA THE
RELAY. </string>
<string name="warn_relay_later">YOU CAN ENABLE RELAY PLAY NOW, OR
LATER.</string>
<string name="warn_relay_remove">YOU CAN ENABLE RELAY PLAY NOW, OR
REMOVE IT FROM THIS GAME.</string>
<string name="warn_relay_havegames">ARE YOU SURE YOU WANT TO
DISABLE PLAY USING THE RELAY?</string>
<plurals name="warn_relay_games_fmt">

View file

@ -1035,7 +1035,22 @@ public class BoardDelegate extends DelegateBase
final Object[] params )
{
boolean handled = false;
if ( AlertDialog.BUTTON_POSITIVE == which ) {
boolean positive = AlertDialog.BUTTON_POSITIVE == which;
DbgUtils.logf("BoardDelegate.dlgButtonClicked(%s, %b)", action.toString(), positive );
if ( Action.ENABLE_RELAY_DO == action ) {
handled = true;
if ( positive ) {
RelayService.setEnabled( m_activity, true );
} else {
// Things get very confused if askDropRelay() is called here.
postDelayed( new Runnable() {
public void run() {
askDropRelay();
}
}, 10 );
}
} else if ( positive ) {
handled = true;
JNICmd cmd = JNICmd.CMD_NONE;
switch ( action ) {
@ -2375,9 +2390,10 @@ public class BoardDelegate extends DelegateBase
}
if ( m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
if ( !RelayService.relayEnabled( m_activity ) ) {
showConfirmThen( R.string.warn_relay_disabled,
R.string.button_enable_relay,
R.string.button_later,
String msg = getString( R.string.warn_relay_disabled )
+ "\n\n" + getString( R.string.warn_relay_remove );
showConfirmThen( msg, R.string.button_enable_relay,
R.string.newgame_drop_relay,
Action.ENABLE_RELAY_DO );
}
}

View file

@ -351,8 +351,9 @@ public class GameConfigDelegate extends DelegateBase
Action.ENABLE_BT_DO );
break;
case COMMS_CONN_RELAY:
showConfirmThen( R.string.warn_relay_disabled,
R.string.button_enable_relay,
String msg = getString( R.string.warn_relay_disabled )
+ "\n\n" + getString( R.string.warn_relay_later );
showConfirmThen( msg, R.string.button_enable_relay,
R.string.button_later,
Action.ENABLE_RELAY_DO );
break;

View file

@ -61,6 +61,7 @@ public class XWConnAddrPreference extends DialogPreference {
m_view.configure( XWPrefs.getAddrTypes( m_context ),
new ConnViaViewLayout.CheckEnabledWarner() {
public void warnDisabled( CommsConnType typ ) {
String msg;
switch( typ ) {
case COMMS_CONN_SMS:
activity.showConfirmThen( R.string.warn_sms_disabled,
@ -74,10 +75,15 @@ public class XWConnAddrPreference extends DialogPreference {
R.string.button_later,
Action.ENABLE_BT_DO );
case COMMS_CONN_RELAY:
activity.showConfirmThen( R.string.warn_relay_disabled,
R.string.button_enable_relay,
msg = LocUtils
.getString( m_context, R.string
.warn_relay_disabled );
msg += "\n\n" + LocUtils
.getString( m_context,
R.string.warn_relay_later );
activity.showConfirmThen( msg, R.string.button_enable_relay,
R.string.button_later,
Action.ENABLE_BT_DO );
Action.ENABLE_RELAY_DO );
break;
default:
Assert.fail();