make params private so can't assign without check

All array elems must be Serializable and I want to check in Debug
builds when new uses are added.
This commit is contained in:
Eric House 2020-08-28 12:14:49 -07:00
parent a580335fea
commit 99f0c09d06
5 changed files with 17 additions and 14 deletions

View file

@ -236,7 +236,7 @@ public class DlgDelegate {
public void run() {
Log.d( TAG, "calling onPosButton()" );
XWActivity xwact = (XWActivity)m_activity;
xwact.onPosButton( action, mState.m_params );
xwact.onPosButton( action, mState.getParams() );
}
});
}

View file

@ -139,7 +139,7 @@ public class DlgDelegateAlert extends XWDialogFragment {
Activity activity = getActivity();
if ( activity instanceof DlgClickNotify ) {
((DlgClickNotify)activity)
.onDismissed( m_state.m_action, m_state.m_params );
.onDismissed( m_state.m_action, m_state.getParams() );
}
}
@ -174,7 +174,7 @@ public class DlgDelegateAlert extends XWDialogFragment {
public void onClick( DialogInterface dlg, int button ) {
checkNotAgainCheck( m_state, naView );
DlgClickNotify xwact = (DlgClickNotify)getActivity();
xwact.onPosButton( pair.action, m_state.m_params );
xwact.onPosButton( pair.action, m_state.getParams() );
}
};
}
@ -197,10 +197,10 @@ public class DlgDelegateAlert extends XWDialogFragment {
DlgClickNotify notify = (DlgClickNotify)activity;
switch ( button ) {
case AlertDialog.BUTTON_POSITIVE:
notify.onPosButton( m_state.m_action, m_state.m_params );
notify.onPosButton( m_state.m_action, m_state.getParams() );
break;
case AlertDialog.BUTTON_NEGATIVE:
notify.onNegButton( m_state.m_action, m_state.m_params );
notify.onNegButton( m_state.m_action, m_state.getParams() );
break;
default:
Log.e( TAG, "unexpected button %d", button );

View file

@ -45,7 +45,7 @@ public class DlgState implements Parcelable {
public ActionPair m_pair = null;
public int m_prefsNAKey;
// These can't be serialized!!!!
public Object[] m_params;
private Object[] m_params;
public String m_title;
public DlgState( DlgID dlgID )
@ -82,6 +82,8 @@ public class DlgState implements Parcelable {
public DlgState setTitle( String title )
{ m_title = title; return this; }
public Object[] getParams() { return m_params; }
@Override
public String toString()
{

View file

@ -68,7 +68,7 @@ public class EnableSMSAlert extends DlgDelegateAlert {
public void onClick( DialogInterface dlg, int item ) {
Assert.assertTrue( 0 < mSpinner.getSelectedItemPosition() );
XWActivity xwact = (XWActivity)getActivity();
xwact.onPosButton( state.m_action, state.m_params );
xwact.onPosButton( state.m_action, state.getParams() );
}
};

View file

@ -51,9 +51,10 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
final ArrayList<InviteMeans> means = new ArrayList<>();
ArrayList<String> items = new ArrayList<>();
InviteMeans lastMeans = null;
if ( null != state.m_params
&& state.m_params[0] instanceof SentInvitesInfo ) {
lastMeans = ((SentInvitesInfo)state.m_params[0]).getLastMeans();
Object[] params = state.getParams();
if ( null != params
&& params[0] instanceof SentInvitesInfo ) {
lastMeans = ((SentInvitesInfo)params[0]).getLastMeans();
}
add( items, means, R.string.invite_choice_email, InviteMeans.EMAIL );
@ -142,7 +143,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
XWActivity activity = (XWActivity)context;
activity.inviteChoiceMade( state.m_action,
means.get(indx),
state.m_params );
state.getParams() );
}
}
};
@ -156,9 +157,9 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
OnClickListener ocl = new OnClickListener() {
@Override
public void onClick( DialogInterface dlg, int pos ) {
if ( state.m_params[0] instanceof SentInvitesInfo ) {
SentInvitesInfo sii = (SentInvitesInfo)
state.m_params[0];
Object[] params = state.getParams();
if ( params[0] instanceof SentInvitesInfo ) {
SentInvitesInfo sii = (SentInvitesInfo)params[0];
sii.setRemotesRobots();
}
okClicked.onClick( dlg, pos );