diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java
index 65bf6ea5f..45d77bde0 100644
--- a/xwords4/android/XWords4/archive/R.java
+++ b/xwords4/android/XWords4/archive/R.java
@@ -652,6 +652,7 @@ public final class R {
*/
public static final int button_download=0x7f05018b;
public static final int button_edit=0x7f0502c4;
+ public static final int button_enable=0x7f050304;
public static final int button_enable_bt=0x7f050224;
public static final int button_enable_sms=0x7f050223;
public static final int button_go_settings=0x7f05025b;
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index 67bcc1b51..319f95bad 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -2491,4 +2491,6 @@
Not all carriers support play
via SMS.
+ Enable
+
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 46c8dafa8..8b840fbd3 100644
--- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
@@ -2154,4 +2154,5 @@
secived.
Ton lla sreirrac troppus yalp
aiv SMS.
+ Elbane
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 b7c4adeb4..ae46b8263 100644
--- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
@@ -2154,4 +2154,5 @@
DEVICES.
NOT ALL CARRIERS SUPPORT PLAY
VIA SMS.
+ ENABLE
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
index f805c0aac..274c396bb 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
@@ -31,10 +31,13 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.AdapterView;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
+
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -239,6 +242,9 @@ public class DlgDelegate {
case INVITE_CHOICES_THEN:
prepareInviteChoicesDialog( dialog );
break;
+ case DIALOG_ENABLESMS:
+ prepareEnableSMSDialog( dialog );
+ break;
}
}
@@ -691,6 +697,7 @@ public class DlgDelegate {
Spinner reasons = (Spinner)
layout.findViewById( R.id.confirm_sms_reasons );
boolean enabled = 0 < reasons.getSelectedItemPosition();
+ Assert.assertTrue( enabled );
Object[] params = { new Boolean(enabled), };
m_clickCallback.dlgButtonClicked( state.m_action,
AlertDialog.BUTTON_POSITIVE,
@@ -701,12 +708,39 @@ public class DlgDelegate {
Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
.setTitle( R.string.confirm_sms_title )
.setView( layout )
- .setPositiveButton( android.R.string.ok, lstnr )
+ .setPositiveButton( R.string.button_enable, lstnr )
+ .setNegativeButton( android.R.string.cancel, null )
.create();
Utils.setRemoveOnDismiss( m_activity, dialog, dlgID );
return dialog;
}
+ private void checkEnableButton( Dialog dialog, Spinner reasons )
+ {
+ boolean enabled = 0 < reasons.getSelectedItemPosition();
+ AlertDialog adlg = (AlertDialog)dialog;
+ Button button = adlg.getButton( AlertDialog.BUTTON_POSITIVE );
+ button.setEnabled( enabled );
+ }
+
+ private void prepareEnableSMSDialog( final Dialog dialog )
+ {
+ final Spinner reasons = (Spinner)
+ dialog.findViewById( R.id.confirm_sms_reasons );
+
+ OnItemSelectedListener onItemSel = new OnItemSelectedListener() {
+ public void onItemSelected( AdapterView> parent, View view,
+ int position, long id )
+ {
+ checkEnableButton( dialog, reasons );
+ }
+
+ public void onNothingSelected( AdapterView> parent ) {}
+ };
+ reasons.setOnItemSelectedListener( onItemSel );
+ checkEnableButton( dialog, reasons );
+ }
+
private OnClickListener mkCallbackClickListener( final DlgState state,
final NotAgainView naView )
{