From 0980bcfbe576b22f4aaa28902a17ba5c7b87e299 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 7 Mar 2017 07:35:16 -0800 Subject: [PATCH] fix another class cast exception But this is by inspection and, involving a dialog that is no longer posted, could probably never occur. --- .../eehouse/android/xw4/BoardDelegate.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index 3ac2cf66a..375e45d65 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -181,18 +181,27 @@ public class BoardDelegate extends DelegateBase Dialog dialog; switch ( dlgID ) { + case DLG_RETRY: case DLG_OKONLY: { int title = (Integer)params[0]; String msg = (String)params[1]; - dialog = ab - .setTitle( title ) + ab.setTitle( title ) .setMessage( msg ) - .setPositiveButton( android.R.string.ok, null ) - .create(); + .setPositiveButton( android.R.string.ok, null ); + if ( DlgID.DLG_RETRY == dlgID ) { + lstnr = new OnClickListener() { + @Override + public void onClick( DialogInterface dlg, + int whichButton ) { + handleViaThread( JNICmd.CMD_RESET ); + } + }; + ab.setNegativeButton( R.string.button_retry, lstnr ); + } + dialog = ab.create(); } break; - case DLG_RETRY: case GAME_OVER: case DLG_CONNSTAT: { GameSummary summary = (GameSummary)params[0]; @@ -201,15 +210,7 @@ public class BoardDelegate extends DelegateBase ab.setTitle( title ) .setMessage( msg ) .setPositiveButton( android.R.string.ok, null ); - if ( DlgID.DLG_RETRY == dlgID ) { - lstnr = new OnClickListener() { - public void onClick( DialogInterface dlg, - int whichButton ) { - handleViaThread( JNICmd.CMD_RESET ); - } - }; - ab.setNegativeButton( R.string.button_retry, lstnr ); - } else if ( DlgID.GAME_OVER == dlgID + if ( DlgID.GAME_OVER == dlgID && rematchSupported( m_activity, true, summary ) ) { lstnr = new OnClickListener() { public void onClick( DialogInterface dlg,