mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
In invite means choice dialog, OK button is enabled until a choice is
made. Required piping prepareDialog() into DlgDelegate.
This commit is contained in:
parent
1b9341bef3
commit
e4b0cd89c2
3 changed files with 33 additions and 1 deletions
|
@ -519,6 +519,9 @@ public class BoardDelegate extends DelegateBase
|
|||
|
||||
ad.setMessage( message );
|
||||
break;
|
||||
default:
|
||||
super.prepareDialog( dlgID, dialog );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public class DelegateBase implements DlgClickNotify,
|
|||
protected void onDestroy() {}
|
||||
protected void onWindowFocusChanged( boolean hasFocus ) {}
|
||||
protected boolean onBackPressed() { return false; }
|
||||
protected void prepareDialog( DlgID dlgID, Dialog dialog ) {}
|
||||
protected void onActivityResult( int requestCode, int resultCode,
|
||||
Intent data )
|
||||
{
|
||||
|
@ -314,6 +313,11 @@ public class DelegateBase implements DlgClickNotify,
|
|||
return m_dlgDelegate.createDialog( id );
|
||||
}
|
||||
|
||||
protected void prepareDialog( DlgID dlgId, Dialog dialog )
|
||||
{
|
||||
m_dlgDelegate.prepareDialog( dlgId, dialog );
|
||||
}
|
||||
|
||||
protected AlertDialog.Builder makeAlertBuilder()
|
||||
{
|
||||
return LocUtils.makeAlertBuilder( m_activity );
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.content.Intent;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import java.util.ArrayList;
|
||||
|
@ -218,6 +219,15 @@ public class DlgDelegate {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
public void prepareDialog( DlgID dlgId, Dialog dialog )
|
||||
{
|
||||
switch( dlgId ) {
|
||||
case INVITE_CHOICES_THEN:
|
||||
prepareInviteChoicesDialog( dialog );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void showOKOnlyDialog( String msg )
|
||||
{
|
||||
showOKOnlyDialog( msg, Action.SKIP_CALLBACK );
|
||||
|
@ -582,6 +592,12 @@ public class DlgDelegate {
|
|||
final int[] sel = { -1 };
|
||||
OnClickListener selChanged = new OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int view ) {
|
||||
// First time through, enable the button
|
||||
if ( -1 == sel[0] ) {
|
||||
((AlertDialog)dlg)
|
||||
.getButton( AlertDialog.BUTTON_POSITIVE )
|
||||
.setEnabled( true );
|
||||
}
|
||||
sel[0] = view;
|
||||
}
|
||||
};
|
||||
|
@ -607,6 +623,15 @@ public class DlgDelegate {
|
|||
return setCallbackDismissListener( builder.create(), state, dlgID );
|
||||
}
|
||||
|
||||
private void prepareInviteChoicesDialog( Dialog dialog )
|
||||
{
|
||||
AlertDialog ad = (AlertDialog)dialog;
|
||||
Button button = ad.getButton( AlertDialog.BUTTON_POSITIVE );
|
||||
if ( null != button ) {
|
||||
button.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
private Dialog createDictGoneDialog()
|
||||
{
|
||||
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity );
|
||||
|
|
Loading…
Reference in a new issue