mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
convert confirmThen alert
This commit is contained in:
parent
c9bc7b6c49
commit
92e150bb1e
2 changed files with 61 additions and 29 deletions
|
@ -0,0 +1,60 @@
|
||||||
|
/* -*- compile-command: "find-and-gradle.sh insXw4Debug"; -*- */
|
||||||
|
/*
|
||||||
|
* Copyright 2017 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eehouse.android.xw4;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
|
|
||||||
|
public class ConfirmThenAlert extends DlgDelegateAlert {
|
||||||
|
|
||||||
|
public static ConfirmThenAlert newInstance( DlgState state )
|
||||||
|
{
|
||||||
|
return new ConfirmThenAlert( state );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfirmThenAlert() {}
|
||||||
|
public ConfirmThenAlert( DlgState state ) { super( state ); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog( Bundle sis )
|
||||||
|
{
|
||||||
|
final Context context = getActivity();
|
||||||
|
|
||||||
|
getBundleData( sis );
|
||||||
|
final DlgState state = getState();
|
||||||
|
|
||||||
|
NotAgainView naView = (NotAgainView)
|
||||||
|
LocUtils.inflate( context, R.layout.not_again_view );
|
||||||
|
naView.setMessage( state.m_msg );
|
||||||
|
naView.setShowNACheckbox( null != state.m_onNAChecked );
|
||||||
|
OnClickListener lstnr = mkCallbackClickListener( naView );
|
||||||
|
|
||||||
|
return LocUtils.makeAlertBuilder( context )
|
||||||
|
.setTitle( state.m_titleId == 0 ? R.string.query_title : state.m_titleId )
|
||||||
|
.setView( naView )
|
||||||
|
.setPositiveButton( state.m_posButton, lstnr )
|
||||||
|
.setNegativeButton( state.m_negButton, lstnr )
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
}
|
|
@ -376,14 +376,8 @@ public class DlgDelegate {
|
||||||
dialog = createLookupDialog();
|
dialog = createLookupDialog();
|
||||||
break;
|
break;
|
||||||
case DIALOG_OKONLY:
|
case DIALOG_OKONLY:
|
||||||
Assert.assertFalse( BuildConfig.DEBUG );
|
|
||||||
break;
|
|
||||||
case DIALOG_NOTAGAIN:
|
case DIALOG_NOTAGAIN:
|
||||||
Assert.assertFalse( BuildConfig.DEBUG );
|
|
||||||
break;
|
|
||||||
case CONFIRM_THEN:
|
case CONFIRM_THEN:
|
||||||
dialog = createConfirmThenDialog( state, dlgID );
|
|
||||||
break;
|
|
||||||
case INVITE_CHOICES_THEN:
|
case INVITE_CHOICES_THEN:
|
||||||
Assert.assertFalse( BuildConfig.DEBUG );
|
Assert.assertFalse( BuildConfig.DEBUG );
|
||||||
break;
|
break;
|
||||||
|
@ -460,8 +454,6 @@ public class DlgDelegate {
|
||||||
DlgState state = new DlgState( DlgID.DIALOG_NOTAGAIN )
|
DlgState state = new DlgState( DlgID.DIALOG_NOTAGAIN )
|
||||||
.setMsg( msg).setPrefsKey( prefsKey ).setAction( action )
|
.setMsg( msg).setPrefsKey( prefsKey ).setAction( action )
|
||||||
.setActionPair( more ).setParams( params );
|
.setActionPair( more ).setParams( params );
|
||||||
// addState( state );
|
|
||||||
// showDialog( DlgID.DIALOG_NOTAGAIN );
|
|
||||||
m_dlgt.show( NotAgainAlert.newInstance( state ) );
|
m_dlgt.show( NotAgainAlert.newInstance( state ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,8 +471,7 @@ public class DlgDelegate {
|
||||||
.setAction( action )
|
.setAction( action )
|
||||||
.setTitle( titleId )
|
.setTitle( titleId )
|
||||||
.setParams( params );
|
.setParams( params );
|
||||||
addState( state );
|
m_dlgt.show( ConfirmThenAlert.newInstance( state ) );
|
||||||
showDialog( DlgID.CONFIRM_THEN );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,8 +486,6 @@ public class DlgDelegate {
|
||||||
DlgState state = new DlgState( DlgID.INVITE_CHOICES_THEN )
|
DlgState state = new DlgState( DlgID.INVITE_CHOICES_THEN )
|
||||||
.setAction( action )
|
.setAction( action )
|
||||||
.setParams( info );
|
.setParams( info );
|
||||||
// addState( state );
|
|
||||||
// showDialog( DlgID.INVITE_CHOICES_THEN );
|
|
||||||
m_dlgt.show( InviteChoicesAlert.newInstance( state ) );
|
m_dlgt.show( InviteChoicesAlert.newInstance( state ) );
|
||||||
} else {
|
} else {
|
||||||
post( new Runnable() {
|
post( new Runnable() {
|
||||||
|
@ -616,23 +605,6 @@ public class DlgDelegate {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createConfirmThenDialog( DlgState state, DlgID dlgID )
|
|
||||||
{
|
|
||||||
NotAgainView naView = (NotAgainView)
|
|
||||||
LocUtils.inflate( m_activity, R.layout.not_again_view );
|
|
||||||
naView.setMessage( state.m_msg );
|
|
||||||
naView.setShowNACheckbox( null != state.m_onNAChecked );
|
|
||||||
OnClickListener lstnr = mkCallbackClickListener( state, naView );
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity )
|
|
||||||
.setTitle( state.m_titleId == 0 ? R.string.query_title : state.m_titleId )
|
|
||||||
.setView( naView )
|
|
||||||
.setPositiveButton( state.m_posButton, lstnr )
|
|
||||||
.setNegativeButton( state.m_negButton, lstnr );
|
|
||||||
|
|
||||||
return setCallbackDismissListener( builder.create(), state, dlgID );
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dialog createDictGoneDialog()
|
private Dialog createDictGoneDialog()
|
||||||
{
|
{
|
||||||
Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
|
Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
|
||||||
|
|
Loading…
Add table
Reference in a new issue