diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index d9228811d..0d75eff57 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -2302,7 +2302,9 @@ public class BoardDelegate extends DelegateBase if ( banned ) { ActionPair pr = new ActionPair( Action.PERMS_BANNED_INFO, R.string.button_more_info ); - builder.setActionPair( pr ); + builder.setActionPair( pr ) + .setNAKey( R.string.key_na_sms_banned ) + ; } builder.setNegButton( R.string.remove_sms ) .show(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConfirmThenAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConfirmThenAlert.java index 080d4464c..910305251 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConfirmThenAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConfirmThenAlert.java @@ -44,8 +44,6 @@ public class ConfirmThenAlert extends DlgDelegateAlert { AlertDialog.Builder builder, NotAgainView naView ) { - naView.setMessage( state.m_msg ); - naView.setShowNACheckbox( null != state.m_onNAChecked ); OnClickListener lstnr = mkCallbackClickListener( naView ); builder.setTitle( state.m_titleId == 0 ? R.string.query_title : state.m_titleId ) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java index 3a1fa59b4..0042caa9f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java @@ -158,7 +158,7 @@ public class DlgDelegate { public abstract class DlgDelegateBuilder { protected String m_msgString; - protected int m_nakey; + protected int m_prefsNAKey; protected Action m_onNA; protected int m_posButton = android.R.string.ok; protected int m_negButton = android.R.string.cancel; @@ -177,7 +177,7 @@ public class DlgDelegate { { m_action = action; return this; } public DlgDelegateBuilder setNAKey( int keyId ) - { m_nakey = keyId; return this; } + { m_prefsNAKey = keyId; return this; } public DlgDelegateBuilder setOnNA( Action onNA ) { m_onNA = onNA; return this; } @@ -220,31 +220,29 @@ public class DlgDelegate { @Override public void show() { - showConfirmThen( m_nakey, m_onNA, m_msgString, m_posButton, + showConfirmThen( m_prefsNAKey, m_onNA, m_msgString, m_posButton, m_negButton, m_action, m_titleId, m_actionPair, m_params ); } } public class NotAgainBuilder extends DlgDelegateBuilder { - private int m_prefsKey; - public NotAgainBuilder(String msg, int key, Action action) - { super(msg, action); m_prefsKey = key; } + { super(msg, action); setNAKey( key ); } public NotAgainBuilder(int msgId, int key, Action action) - { super(msgId, action); m_prefsKey = key; } + { super(msgId, action); m_prefsNAKey = key; } public NotAgainBuilder( String msg, int key ) - { super( msg, Action.SKIP_CALLBACK ); m_prefsKey = key; } + { super( msg, Action.SKIP_CALLBACK ); m_prefsNAKey = key; } public NotAgainBuilder( int msgId, int key ) - { super( msgId, Action.SKIP_CALLBACK ); m_prefsKey = key; } + { super( msgId, Action.SKIP_CALLBACK ); m_prefsNAKey = key; } @Override public void show() { - showNotAgainDlgThen( m_msgString, m_prefsKey, + showNotAgainDlgThen( m_msgString, m_prefsNAKey, m_action, m_actionPair, m_params ); } @@ -395,14 +393,16 @@ public class DlgDelegate { if ( 0 == nakey || ! XWPrefs.getPrefsBoolean( m_activity, nakey, false ) ) { DlgState state = new DlgState( DlgID.CONFIRM_THEN ) - .setOnNA(onNA) + .setOnNA( onNA ) .setMsg( msg ) .setPosButton( posButton ) .setNegButton( negButton ) .setAction( action ) .setTitle( titleId ) .setActionPair( more ) - .setParams( params ); + .setParams( params ) + .setPrefsKey( nakey ) + ; m_dlgt.show( state ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java index 84d1e6c6a..f0436990c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java @@ -78,7 +78,7 @@ abstract class DlgDelegateAlert extends XWDialogFragment { NotAgainView naView = ((NotAgainView)LocUtils.inflate( context, R.layout.not_again_view )) .setMessage( state.m_msg ) - .setShowNACheckbox( 0 != state.m_prefsKey ); + .setShowNACheckbox( 0 != state.m_prefsNAKey ); AlertDialog.Builder builder = LocUtils.makeAlertBuilder( context ) .setView( naView ) @@ -123,8 +123,8 @@ abstract class DlgDelegateAlert extends XWDialogFragment { protected void checkNotAgainCheck( DlgState state, NotAgainView naView ) { if ( null != naView && naView.getChecked() ) { - if ( 0 != state.m_prefsKey ) { - XWPrefs.setPrefsBoolean( getActivity(), m_state.m_prefsKey, + if ( 0 != state.m_prefsNAKey ) { + XWPrefs.setPrefsBoolean( getActivity(), m_state.m_prefsNAKey, true ); } else if ( null != state.m_onNAChecked ) { DlgClickNotify notify = (DlgClickNotify)getActivity(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java index 850971e10..2be7e178d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java @@ -43,7 +43,7 @@ public class DlgState implements Parcelable { public int m_negButton; public Action m_action = null; public ActionPair m_pair = null; - public int m_prefsKey; + public int m_prefsNAKey; // These can't be serialized!!!! public Object[] m_params; public Action m_onNAChecked; @@ -57,7 +57,7 @@ public class DlgState implements Parcelable { public DlgState setMsg( String msg ) { m_msg = msg; return this; } public DlgState setPrefsKey( int key ) - { m_prefsKey = key; return this; } + { m_prefsNAKey = key; return this; } public DlgState setAction( Action action ) { m_action = action; return this; } public DlgState setParams( Object... params ) @@ -100,7 +100,7 @@ public class DlgState implements Parcelable { return String.format("[id: %s; msg: %s; key: %s; action: %s; pair %s; " + "na: %s; pos: %d; neg: %d; title: %d; " + "params: %s]", - m_id, m_msg, m_prefsKey, m_action, m_pair, m_onNAChecked, + m_id, m_msg, m_prefsNAKey, m_action, m_pair, m_onNAChecked, m_posButton, m_negButton, m_titleId, params ); } else { return super.toString(); @@ -123,7 +123,7 @@ public class DlgState implements Parcelable { && m_negButton == other.m_negButton && m_action == other.m_action && ((null == m_pair) ? (null == other.m_pair) : m_pair.equals(other.m_pair)) - && m_prefsKey == other.m_prefsKey + && m_prefsNAKey == other.m_prefsNAKey && Arrays.deepEquals( m_params, other.m_params ) && m_onNAChecked == other.m_onNAChecked && m_titleId == other.m_titleId; @@ -158,7 +158,7 @@ public class DlgState implements Parcelable { out.writeInt( m_posButton ); out.writeInt( m_negButton ); out.writeInt( null == m_action ? -1 : m_action.ordinal() ); - out.writeInt( m_prefsKey ); + out.writeInt( m_prefsNAKey ); out.writeInt( null == m_onNAChecked ? -1 : m_onNAChecked.ordinal() ); out.writeInt( m_titleId ); out.writeString( m_msg ); diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml index fde42fefd..ab5d9e483 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -143,6 +143,7 @@ key_na_comms_sms key_na_comms_relay key_na_bt_badproto + key_na_sms_banned xwords@eehouse.org