cleanup: use AlertDialog not Dialog

This commit is contained in:
Eric House 2021-02-25 08:56:08 -08:00
parent 5c09d9b9a4
commit 9804594237
3 changed files with 9 additions and 12 deletions

View file

@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -92,7 +91,7 @@ public class DlgDelegateAlert extends XWDialogFragment {
} }
} }
Dialog create( AlertDialog.Builder builder ) { return builder.create(); } AlertDialog create( AlertDialog.Builder builder ) { return builder.create(); }
private NotAgainView addNAView( DlgState state, AlertDialog.Builder builder ) private NotAgainView addNAView( DlgState state, AlertDialog.Builder builder )
{ {
@ -109,7 +108,7 @@ public class DlgDelegateAlert extends XWDialogFragment {
} }
@Override @Override
public final Dialog onCreateDialog( Bundle sis ) public final AlertDialog onCreateDialog( Bundle sis )
{ {
Context context = getActivity(); Context context = getActivity();
DlgState state = getState( sis ); DlgState state = getState( sis );

View file

@ -20,7 +20,6 @@
package org.eehouse.android.xw4; package org.eehouse.android.xw4;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
@ -56,7 +55,7 @@ public class EnableSMSAlert extends DlgDelegateAlert {
@Override @Override
public void onItemSelected( AdapterView<?> parent, View view, public void onItemSelected( AdapterView<?> parent, View view,
int position, long id ) { int position, long id ) {
checkEnableButton( getDialog() ); checkEnableButton( (AlertDialog)getDialog() );
} }
@Override @Override
public void onNothingSelected( AdapterView<?> parent ) {} public void onNothingSelected( AdapterView<?> parent ) {}
@ -80,20 +79,20 @@ public class EnableSMSAlert extends DlgDelegateAlert {
} }
@Override @Override
Dialog create( AlertDialog.Builder builder ) AlertDialog create( AlertDialog.Builder builder )
{ {
Dialog dialog = super.create( builder ); AlertDialog dialog = super.create( builder );
dialog.setOnShowListener(new DialogInterface.OnShowListener() { dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override @Override
public void onShow( DialogInterface dialog ) { public void onShow( DialogInterface dialog ) {
checkEnableButton( (Dialog)dialog ); checkEnableButton( (AlertDialog)dialog );
} }
}); });
return dialog; return dialog;
} }
private void checkEnableButton( Dialog dialog ) private void checkEnableButton( AlertDialog dialog )
{ {
boolean enabled = 0 < mSpinner.getSelectedItemPosition(); boolean enabled = 0 < mSpinner.getSelectedItemPosition();
((AlertDialog)dialog) ((AlertDialog)dialog)

View file

@ -20,7 +20,6 @@
package org.eehouse.android.xw4; package org.eehouse.android.xw4;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -181,9 +180,9 @@ public class InviteChoicesAlert extends DlgDelegateAlert
} }
@Override @Override
Dialog create( AlertDialog.Builder builder ) AlertDialog create( AlertDialog.Builder builder )
{ {
Dialog dialog = super.create( builder ); AlertDialog dialog = super.create( builder );
dialog.setOnShowListener(new DialogInterface.OnShowListener() { dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override @Override
public void onShow( DialogInterface diface ) { public void onShow( DialogInterface diface ) {