mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
fix crash; use params
Pass blank-picking params through rather than using instance variables.
This commit is contained in:
parent
e631d57e9b
commit
c088e36113
2 changed files with 18 additions and 22 deletions
|
@ -114,14 +114,11 @@ public class BoardDelegate extends DelegateBase
|
||||||
private ArrayList<String> m_pendingChats;
|
private ArrayList<String> m_pendingChats;
|
||||||
|
|
||||||
private EditText m_passwdEdit;
|
private EditText m_passwdEdit;
|
||||||
private String[] m_texts;
|
|
||||||
private CommsConnTypeSet m_connTypes = null;
|
private CommsConnTypeSet m_connTypes = null;
|
||||||
private String[] m_missingDevs;
|
private String[] m_missingDevs;
|
||||||
private int[] m_missingCounts;
|
private int[] m_missingCounts;
|
||||||
private InviteMeans m_missingMeans = null;
|
private InviteMeans m_missingMeans = null;
|
||||||
private boolean m_progressShown = false;
|
private boolean m_progressShown = false;
|
||||||
private String m_curTiles;
|
|
||||||
private boolean m_canUndoTiles;
|
|
||||||
private boolean m_firingPrefs;
|
private boolean m_firingPrefs;
|
||||||
private JNIUtils m_jniu;
|
private JNIUtils m_jniu;
|
||||||
private boolean m_inTrade; // save this in bundle?
|
private boolean m_inTrade; // save this in bundle?
|
||||||
|
@ -335,7 +332,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PICK_TILE_REQUESTBLANK_BLK:
|
case PICK_TILE_REQUESTBLANK_BLK:
|
||||||
case PICK_TILE_REQUESTTRAY_BLK:
|
case PICK_TILE_REQUESTTRAY_BLK: {
|
||||||
|
String[] texts = (String[])params[0];
|
||||||
checkBlocking();
|
checkBlocking();
|
||||||
lstnr = new OnClickListener() {
|
lstnr = new OnClickListener() {
|
||||||
public void onClick( DialogInterface dialog,
|
public void onClick( DialogInterface dialog,
|
||||||
|
@ -343,13 +341,16 @@ public class BoardDelegate extends DelegateBase
|
||||||
m_resultCode = item;
|
m_resultCode = item;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ab.setItems( m_texts, lstnr );
|
ab.setItems( texts, lstnr );
|
||||||
|
|
||||||
if ( DlgID.PICK_TILE_REQUESTBLANK_BLK == dlgID ) {
|
if ( DlgID.PICK_TILE_REQUESTBLANK_BLK == dlgID ) {
|
||||||
ab.setTitle( R.string.title_tile_picker );
|
ab.setTitle( R.string.title_tile_picker );
|
||||||
} else {
|
} else {
|
||||||
ab.setTitle( getString( R.string.cur_tiles_fmt, m_curTiles ) );
|
String curTiles = (String)params[1];
|
||||||
if ( m_canUndoTiles ) {
|
boolean canUndoTiles = (Boolean)params[2];
|
||||||
|
|
||||||
|
ab.setTitle( getString( R.string.cur_tiles_fmt, curTiles ) );
|
||||||
|
if ( canUndoTiles ) {
|
||||||
OnClickListener undoClicked = new OnClickListener() {
|
OnClickListener undoClicked = new OnClickListener() {
|
||||||
public void onClick( DialogInterface dialog,
|
public void onClick( DialogInterface dialog,
|
||||||
int whichButton ) {
|
int whichButton ) {
|
||||||
|
@ -372,6 +373,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
dialog = ab.create();
|
dialog = ab.create();
|
||||||
alert.setOnDismissListener( m_blockingODL );
|
alert.setOnDismissListener( m_blockingODL );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASK_PASSWORD_BLK:
|
case ASK_PASSWORD_BLK:
|
||||||
|
@ -1785,10 +1787,9 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
// This is supposed to be called from the jni thread
|
// This is supposed to be called from the jni thread
|
||||||
@Override
|
@Override
|
||||||
public int userPickTileBlank( int playerNum, String[] texts)
|
public int userPickTileBlank( int playerNum, String[] texts )
|
||||||
{
|
{
|
||||||
m_texts = texts;
|
waitBlockingDialog( DlgID.PICK_TILE_REQUESTBLANK_BLK, 0, (Object)texts );
|
||||||
waitBlockingDialog( DlgID.PICK_TILE_REQUESTBLANK_BLK, 0 );
|
|
||||||
return m_resultCode;
|
return m_resultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,11 +1797,11 @@ public class BoardDelegate extends DelegateBase
|
||||||
public int userPickTileTray( int playerNum, String[] texts,
|
public int userPickTileTray( int playerNum, String[] texts,
|
||||||
String[] curTiles, int nPicked )
|
String[] curTiles, int nPicked )
|
||||||
{
|
{
|
||||||
m_texts = texts;
|
String curTilesStr = TextUtils.join( ", ", curTiles );
|
||||||
m_curTiles = TextUtils.join( ", ", curTiles );
|
boolean canUndoTiles = 0 < nPicked;
|
||||||
m_canUndoTiles = 0 < nPicked;
|
|
||||||
waitBlockingDialog( DlgID.PICK_TILE_REQUESTTRAY_BLK,
|
waitBlockingDialog( DlgID.PICK_TILE_REQUESTTRAY_BLK,
|
||||||
UtilCtxt.PICKER_PICKALL );
|
UtilCtxt.PICKER_PICKALL, texts, curTilesStr,
|
||||||
|
canUndoTiles );
|
||||||
return m_resultCode;
|
return m_resultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2351,13 +2352,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
} // populateToolbar
|
} // populateToolbar
|
||||||
|
|
||||||
private int waitBlockingDialog( final DlgID dlgID, int cancelResult )
|
|
||||||
{
|
|
||||||
return waitBlockingDialog( dlgID, cancelResult, 0, null );
|
|
||||||
}
|
|
||||||
|
|
||||||
private int waitBlockingDialog( final DlgID dlgID, int cancelResult,
|
private int waitBlockingDialog( final DlgID dlgID, int cancelResult,
|
||||||
final int title, final String msg )
|
final Object... params )
|
||||||
{
|
{
|
||||||
int result = cancelResult;
|
int result = cancelResult;
|
||||||
// this has been true; dunno why
|
// this has been true; dunno why
|
||||||
|
@ -2371,7 +2367,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
if ( post( new Runnable() {
|
if ( post( new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
m_blockingDlgID = dlgID;
|
m_blockingDlgID = dlgID;
|
||||||
showDialogFragment( dlgID, title, msg );
|
showDialogFragment( dlgID, params );
|
||||||
}
|
}
|
||||||
} ) ) {
|
} ) ) {
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class DBAlert extends DialogFragment {
|
||||||
{
|
{
|
||||||
if ( BuildConfig.DEBUG ) {
|
if ( BuildConfig.DEBUG ) {
|
||||||
for ( Object obj : params ) {
|
for ( Object obj : params ) {
|
||||||
if ( !(obj instanceof Serializable) ) {
|
if ( null != obj && !(obj instanceof Serializable) ) {
|
||||||
DbgUtils.logd( TAG, "OOPS: %s not Serializable",
|
DbgUtils.logd( TAG, "OOPS: %s not Serializable",
|
||||||
obj.getClass().getName() );
|
obj.getClass().getName() );
|
||||||
// Assert.fail();
|
// Assert.fail();
|
||||||
|
|
Loading…
Reference in a new issue