mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-22 07:28:16 +01:00
support setActionPair() for okOnly alerts too
This commit is contained in:
parent
4493f9d9cd
commit
c59e86b724
3 changed files with 19 additions and 5 deletions
|
@ -207,8 +207,8 @@ public class DlgDelegate {
|
|||
@Override
|
||||
public void show()
|
||||
{
|
||||
Assert.assertTrue( null == m_actionPair || !BuildConfig.DEBUG );
|
||||
showOKOnlyDialogThen( m_msgString, m_action, m_params, m_titleId );
|
||||
showOKOnlyDialogThen( m_msgString, m_action, m_actionPair,
|
||||
m_params, m_titleId );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,12 +337,14 @@ public class DlgDelegate {
|
|||
}
|
||||
|
||||
private void showOKOnlyDialogThen( String msg, Action action,
|
||||
Object[] params, int titleId )
|
||||
ActionPair more, Object[] params,
|
||||
int titleId )
|
||||
{
|
||||
DlgState state = new DlgState( DlgID.DIALOG_OKONLY )
|
||||
.setMsg( msg )
|
||||
.setParams( params )
|
||||
.setTitle( titleId )
|
||||
.setActionPair( more )
|
||||
.setAction(action);
|
||||
m_dlgt.show( state );
|
||||
}
|
||||
|
|
|
@ -120,6 +120,11 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
|
|||
};
|
||||
}
|
||||
|
||||
protected OnClickListener mkCallbackClickListener( ActionPair pair )
|
||||
{
|
||||
return mkCallbackClickListener( pair, null );
|
||||
}
|
||||
|
||||
protected OnClickListener mkCallbackClickListener( final NotAgainView naView )
|
||||
{
|
||||
OnClickListener cbkOnClickLstnr;
|
||||
|
|
|
@ -52,11 +52,18 @@ public class OkOnlyAlert extends DlgDelegateAlert {
|
|||
|
||||
final DlgState state = getState( sis );
|
||||
|
||||
Dialog dialog = LocUtils.makeAlertBuilder( getActivity() )
|
||||
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( getActivity() )
|
||||
.setTitle( state.m_titleId == 0 ? R.string.info_title : state.m_titleId )
|
||||
.setMessage( state.m_msg )
|
||||
.setPositiveButton( android.R.string.ok, null )
|
||||
.create();
|
||||
;
|
||||
|
||||
ActionPair pair = state.m_pair;
|
||||
if ( null != pair ) {
|
||||
builder.setNeutralButton( pair.buttonStr, mkCallbackClickListener( pair ) );
|
||||
}
|
||||
|
||||
Dialog dialog = builder.create();
|
||||
// dialog = setCallbackDismissListener( dialog, state, dlgID );
|
||||
return dialog;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue