offer to turn SMS on when setting the global pref too

This commit is contained in:
Eric House 2015-02-13 18:16:30 -08:00
parent 9399ddd0ab
commit 49024ae070
8 changed files with 50 additions and 43 deletions

View file

@ -54,21 +54,21 @@ public final class R {
public static final int in_arrow=0x7f020012;
public static final int in_arrow_active=0x7f020013;
public static final int multigame__gen=0x7f020014;
public static final int multigame_new__gen=0x7f020015;
public static final int new_group__gen=0x7f020016;
public static final int next_hint=0x7f020017;
public static final int origin=0x7f020018;
public static final int out_arrow=0x7f020019;
public static final int out_arrow_active=0x7f02001a;
public static final int prefs__gen=0x7f02001b;
public static final int prev_hint=0x7f02001c;
public static final int refresh=0x7f02001d;
public static final int relabel__gen=0x7f02001e;
public static final int reset__gen=0x7f02001f;
public static final int rightarrow=0x7f020020;
public static final int save__gen=0x7f020021;
public static final int search__gen=0x7f020022;
public static final int select_all__gen=0x7f020023;
public static final int new_group__gen=0x7f020015;
public static final int next_hint=0x7f020016;
public static final int origin=0x7f020017;
public static final int out_arrow=0x7f020018;
public static final int out_arrow_active=0x7f020019;
public static final int prefs__gen=0x7f02001a;
public static final int prev_hint=0x7f02001b;
public static final int refresh=0x7f02001c;
public static final int relabel__gen=0x7f02001d;
public static final int reset__gen=0x7f02001e;
public static final int rightarrow=0x7f02001f;
public static final int save__gen=0x7f020020;
public static final int search__gen=0x7f020021;
public static final int select_all__gen=0x7f020022;
public static final int send__gen=0x7f020023;
public static final int shuffle=0x7f020024;
public static final int sologame__gen=0x7f020025;
public static final int stat_notify_chat=0x7f020026;
@ -552,7 +552,7 @@ public final class R {
reset a game.
*/
public static final int button_discard=0x7f0501b9;
public static final int button_discard_changes=0x7f0502e4;
public static final int button_discard_changes=0x7f0502e3;
/**
*/
public static final int button_done=0x7f0501e9;
@ -562,7 +562,7 @@ public final class R {
/** Text of button displayed when downloading is an option
*/
public static final int button_download=0x7f0501ad;
public static final int button_edit=0x7f0502e3;
public static final int button_edit=0x7f0502e2;
public static final int button_enable_sms=0x7f05024a;
public static final int button_go_settings=0x7f050283;
/**
@ -735,7 +735,7 @@ public final class R {
on the board.
*/
public static final int clr_crosshairs=0x7f05015c;
public static final int config_no_connvia=0x7f0502e2;
public static final int config_no_connvia=0x7f0502e1;
/**
*/
public static final int confirm_clear=0x7f050226;
@ -1008,7 +1008,6 @@ public final class R {
/**
*/
public static final int enable_sms=0x7f050241;
public static final int enable_sms_first=0x7f0502e0;
/**
*/
public static final int enable_sms_summary=0x7f050242;
@ -2611,7 +2610,7 @@ public final class R {
line in a game summary. The \u0020 is a space in xml.
*/
public static final int vs_join=0x7f050127;
public static final int warn_no_comms=0x7f0502e1;
public static final int warn_no_comms=0x7f0502e0;
/**
*/
public static final int warn_nomobile_fmt=0x7f050223;

View file

@ -1981,8 +1981,8 @@
<!-- -->
<string name="warn_sms_disabled">Play via SMS is currently
disabled. No moves will be sent via SMS for this game.\n\nYou can
enable play via SMS now, or later.
disabled. No moves will be sent via SMS.\n\nYou can enable play
via SMS now, or later.
</string>
<string name="button_enable_sms">Enable SMS</string>
@ -2300,7 +2300,6 @@
game is open.</string>
<string name="enable_bt_first">Please turn Bluetooth on before enabling.</string>
<string name="enable_sms_first">Please check \"Allow games via SMS\" before enabling.</string>
<string name="warn_no_comms">Every networked game must have at
least one way of communicating. If you have no default connection

View file

@ -1705,8 +1705,8 @@
<string name="confirm_sms_willpay">Sey: I\'ll yap lla reirrac segrahc</string>
<!-- -->
<string name="warn_sms_disabled">Yalp aiv SMS si yltnerruc
delbasid. On sevom lliw eb tnes aiv SMS rof siht emag.\n\nUoy nac
elbane yalp aiv SMS ,won ro retal.
delbasid. On sevom lliw eb tnes aiv SMS.\n\nUoy nac elbane yalp
aiv SMS ,won ro retal.
</string>
<string name="button_enable_sms">Elbane SMS</string>
<string name="button_later">Retal</string>
@ -1952,7 +1952,6 @@
fo siht ecived tsniaga eht eno uoy tnaw ot yna—etivni emit eht
emag si nepo.</string>
<string name="enable_bt_first">Esaelp nrut Htooteulb no erofeb gnilbane.</string>
<string name="enable_sms_first">Esaelp kcehc \"Wolla semag aiv SMS\" erofeb gnilbane.</string>
<string name="warn_no_comms">Yreve dekrowten emag tsum evah ta
tsael eno yaw fo gnitacinummoc. Fi uoy evah on tluafed noitcennoc
snoitpo yreve wen dekrowten emag lliw evah ot eb derugifnoc

View file

@ -1705,8 +1705,8 @@
<string name="confirm_sms_willpay">YES: I\'LL PAY ALL CARRIER CHARGES</string>
<!-- -->
<string name="warn_sms_disabled">PLAY VIA SMS IS CURRENTLY
DISABLED. NO MOVES WILL BE SENT VIA SMS FOR THIS GAME.\n\nYOU CAN
ENABLE PLAY VIA SMS NOW, OR LATER.
DISABLED. NO MOVES WILL BE SENT VIA SMS.\n\nYOU CAN ENABLE PLAY
VIA SMS NOW, OR LATER.
</string>
<string name="button_enable_sms">ENABLE SMS</string>
<string name="button_later">LATER</string>
@ -1952,7 +1952,6 @@
OF THIS DEVICE AGAINST THE ONE YOU WANT TO INVITE—ANY TIME THE
GAME IS OPEN.</string>
<string name="enable_bt_first">PLEASE TURN BLUETOOTH ON BEFORE ENABLING.</string>
<string name="enable_sms_first">PLEASE CHECK \"ALLOW GAMES VIA SMS\" BEFORE ENABLING.</string>
<string name="warn_no_comms">EVERY NETWORKED GAME MUST HAVE AT
LEAST ONE WAY OF COMMUNICATING. IF YOU HAVE NO DEFAULT CONNECTION
OPTIONS EVERY NEW NETWORKED GAME WILL HAVE TO BE CONFIGURED

View file

@ -509,7 +509,17 @@ public class DelegateBase implements DlgClickNotify,
//////////////////////////////////////////////////////////////////////
public void dlgButtonClicked( Action action, int button, Object[] params )
{
if ( BuildConfig.DEBUG ) {
boolean handled = false;
if ( AlertDialog.BUTTON_POSITIVE == button ) {
switch( action ) {
case ENABLE_SMS_ASK:
showSMSEnableDialog( Action.ENABLE_SMS_DO );
handled = true;
break;
}
}
if ( !handled && BuildConfig.DEBUG ) {
String buttonName = null;
switch( button ) {
case AlertDialog.BUTTON_POSITIVE:

View file

@ -652,9 +652,6 @@ public class GameConfigDelegate extends DelegateBase
}
finish();
break;
case ENABLE_SMS_ASK:
showSMSEnableDialog( Action.ENABLE_SMS_DO );
break;
case ENABLE_SMS_DO:
boolean enabled = (Boolean)params[0];
if ( enabled ) {

View file

@ -93,6 +93,12 @@ public class PrefsActivity extends PreferenceActivity implements Delegator {
m_dlgt.showOKOnlyDialog( msgID );
}
protected void showConfirmThen( int msg, int posButton, int negButton,
Action action )
{
m_dlgt.showConfirmThen( msg, posButton, negButton, action );
}
protected void showSMSEnableDialog( Action action )
{
m_dlgt.showSMSEnableDialog( action );

View file

@ -27,9 +27,10 @@ import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.loc.LocUtils;
public class XWConnAddrPreference extends DialogPreference {
@ -57,20 +58,17 @@ public class XWConnAddrPreference extends DialogPreference {
m_view.configure( XWPrefs.getAddrTypes( m_context ),
new ConnViaViewLayout.CheckEnabledWarner() {
public void warnDisabled( CommsConnType typ ) {
int id;
PrefsActivity activity = (PrefsActivity)m_context;
switch( typ ) {
case COMMS_CONN_SMS:
id = R.string.enable_sms_first;
activity.showConfirmThen( R.string.warn_sms_disabled,
R.string.button_enable_sms,
R.string.button_later,
Action.ENABLE_SMS_ASK );
break;
case COMMS_CONN_BT:
id = R.string.enable_bt_first;
activity.showOKOnlyDialog( R.string.enable_bt_first );
break;
default:
id = 0;
}
if ( 0 != id ) {
PrefsActivity activity = (PrefsActivity)m_context;
activity.showOKOnlyDialog( id );
}
}
},