DroidFish: Fixed "load scid file" dialog to work on pre-2.2 devices. (Thanks to Gerhard Kaleb for pointing this out.)

This commit is contained in:
Peter Osterlund 2011-11-14 17:57:55 +00:00
parent 96047e29ec
commit cafab99c8a

View File

@ -948,8 +948,7 @@ public class DroidFish extends Activity implements GUIInterface {
static private final int THINKING_MENU_DIALOG = 11; static private final int THINKING_MENU_DIALOG = 11;
static private final int GO_BACK_MENU_DIALOG = 12; static private final int GO_BACK_MENU_DIALOG = 12;
static private final int GO_FORWARD_MENU_DIALOG = 13; static private final int GO_FORWARD_MENU_DIALOG = 13;
static private final int SELECT_SCID_FILE_DIALOG = 14; static private final int FILE_MENU_DIALOG = 14;
static private final int FILE_MENU_DIALOG = 15;
@Override @Override
protected Dialog onCreateDialog(int id) { protected Dialog onCreateDialog(int id) {
@ -1022,8 +1021,7 @@ public class DroidFish extends Activity implements GUIInterface {
showDialog(SELECT_PGN_FILE_DIALOG); showDialog(SELECT_PGN_FILE_DIALOG);
break; break;
case LOAD_SCID_GAME: case LOAD_SCID_GAME:
removeDialog(SELECT_SCID_FILE_DIALOG); selectScidFile();
showDialog(SELECT_SCID_FILE_DIALOG);
break; break;
case SAVE_GAME: case SAVE_GAME:
removeDialog(SELECT_PGN_FILE_SAVE_DIALOG); removeDialog(SELECT_PGN_FILE_SAVE_DIALOG);
@ -1062,8 +1060,7 @@ public class DroidFish extends Activity implements GUIInterface {
showDialog(SELECT_PGN_FILE_SAVE_DIALOG); showDialog(SELECT_PGN_FILE_SAVE_DIALOG);
break; break;
case LOAD_SCID_GAME: case LOAD_SCID_GAME:
removeDialog(SELECT_SCID_FILE_DIALOG); selectScidFile();
showDialog(SELECT_SCID_FILE_DIALOG);
break; break;
} }
} }
@ -1203,14 +1200,6 @@ public class DroidFish extends Activity implements GUIInterface {
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
return alert; return alert;
} }
case SELECT_SCID_FILE_DIALOG: {
Intent intent = new Intent();
intent.setComponent(new ComponentName("org.scid.android",
"org.scid.android.SelectFileActivity"));
intent.setAction(".si4");
startActivityForResult(intent, RESULT_SELECT_SCID);
return null;
}
case SELECT_PGN_FILE_SAVE_DIALOG: { case SELECT_PGN_FILE_SAVE_DIALOG: {
final String[] fileNames = findFilesInDirectory(pgnDir, null); final String[] fileNames = findFilesInDirectory(pgnDir, null);
final int numFiles = fileNames.length; final int numFiles = fileNames.length;
@ -1568,6 +1557,14 @@ public class DroidFish extends Activity implements GUIInterface {
return null; return null;
} }
private final void selectScidFile() {
Intent intent = new Intent();
intent.setComponent(new ComponentName("org.scid.android",
"org.scid.android.SelectFileActivity"));
intent.setAction(".si4");
startActivityForResult(intent, RESULT_SELECT_SCID);
}
final static int FT_NONE = 0; final static int FT_NONE = 0;
final static int FT_PGN = 1; final static int FT_PGN = 1;
final static int FT_SCID = 2; final static int FT_SCID = 2;