mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-29 10:26:36 +01:00
add not-again checkbox to remove-sms-from-game alert
Some people will decide to leave SMS comms in while I look for an alternative. Maybe. Don't show them the same alert every time they open the game. In the process removed what seemed to be a duplicate ivar.
This commit is contained in:
parent
f05c6862f9
commit
eb33d18390
6 changed files with 24 additions and 23 deletions
|
@ -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();
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -143,6 +143,7 @@
|
|||
<string name="key_na_comms_sms">key_na_comms_sms</string>
|
||||
<string name="key_na_comms_relay">key_na_comms_relay</string>
|
||||
<string name="key_na_bt_badproto">key_na_bt_badproto</string>
|
||||
<string name="key_na_sms_banned">key_na_sms_banned</string>
|
||||
|
||||
<!-- Nor is my email address -->
|
||||
<string name="email_author_email">xwords@eehouse.org</string>
|
||||
|
|
Loading…
Reference in a new issue