From 49024ae07036ab5a2e17f86533f48b626931d4c7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 13 Feb 2015 18:16:30 -0800 Subject: [PATCH] offer to turn SMS on when setting the global pref too --- xwords4/android/XWords4/archive/R.java | 39 +++++++++---------- .../android/XWords4/res/values/strings.xml | 5 +-- .../XWords4/res_src/values-ba_CK/strings.xml | 5 +-- .../XWords4/res_src/values-ca_PS/strings.xml | 5 +-- .../org/eehouse/android/xw4/DelegateBase.java | 12 +++++- .../android/xw4/GameConfigDelegate.java | 3 -- .../eehouse/android/xw4/PrefsActivity.java | 6 +++ .../android/xw4/XWConnAddrPreference.java | 18 ++++----- 8 files changed, 50 insertions(+), 43 deletions(-) diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java index c6bbcd1e2..fd4c7a155 100644 --- a/xwords4/android/XWords4/archive/R.java +++ b/xwords4/android/XWords4/archive/R.java @@ -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; diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index ded3943b0..b34cd168b 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -1981,8 +1981,8 @@ 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. Enable SMS @@ -2300,7 +2300,6 @@ game is open. Please turn Bluetooth on before enabling. - Please check \"Allow games via SMS\" before enabling. Every networked game must have at least one way of communicating. If you have no default connection diff --git a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml index 27d703722..1e71a7abe 100644 --- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml @@ -1705,8 +1705,8 @@ Sey: I\'ll yap lla reirrac segrahc 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. Elbane SMS Retal @@ -1952,7 +1952,6 @@ fo siht ecived tsniaga eht eno uoy tnaw ot yna—etivni emit eht emag si nepo. Esaelp nrut Htooteulb no erofeb gnilbane. - Esaelp kcehc \"Wolla semag aiv SMS\" erofeb gnilbane. 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 diff --git a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml index 5fee5c588..496658849 100644 --- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml @@ -1705,8 +1705,8 @@ YES: I\'LL PAY ALL CARRIER CHARGES 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. ENABLE SMS LATER @@ -1952,7 +1952,6 @@ OF THIS DEVICE AGAINST THE ONE YOU WANT TO INVITE—ANY TIME THE GAME IS OPEN. PLEASE TURN BLUETOOTH ON BEFORE ENABLING. - PLEASE CHECK \"ALLOW GAMES VIA SMS\" BEFORE ENABLING. 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 diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index c9a194b65..ed5614cdb 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -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: diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java index 3406cf9c7..515c48a35 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java @@ -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 ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java index bdbd0a299..400572733 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java @@ -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 ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java index 85ac9b6e5..19a5d8be3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java @@ -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 ); } } },