mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-01-30 17:13:50 +01:00
DroidFish: When loading a game, switch game mode to edit/replay.
This commit is contained in:
parent
03342fb46b
commit
3913b818d6
|
@ -305,12 +305,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
oldGameModeType = ctrl.getGameMode().getModeNr();
|
||||
gameModeType = GameMode.ANALYSIS;
|
||||
}
|
||||
Editor editor = settings.edit();
|
||||
String gameModeStr = String.format("%d", gameModeType);
|
||||
editor.putString("gameMode", gameModeStr);
|
||||
editor.commit();
|
||||
gameMode = new GameMode(gameModeType);
|
||||
ctrl.setGameMode(gameMode);
|
||||
newGameMode(gameModeType);
|
||||
setBoardFlip(true);
|
||||
}
|
||||
});
|
||||
|
@ -1196,6 +1191,9 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
if (resultCode == RESULT_OK) {
|
||||
try {
|
||||
String pgn = data.getAction();
|
||||
int modeNr = ctrl.getGameMode().getModeNr();
|
||||
if ((modeNr != GameMode.ANALYSIS) && (modeNr != GameMode.EDIT_GAME))
|
||||
newGameMode(GameMode.EDIT_GAME);
|
||||
ctrl.setFENOrPGN(pgn);
|
||||
setBoardFlip(true);
|
||||
} catch (ChessParseError e) {
|
||||
|
@ -1238,6 +1236,16 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/** Set new game mode. */
|
||||
private final void newGameMode(int gameModeType) {
|
||||
Editor editor = settings.edit();
|
||||
String gameModeStr = String.format("%d", gameModeType);
|
||||
editor.putString("gameMode", gameModeStr);
|
||||
editor.commit();
|
||||
gameMode = new GameMode(gameModeType);
|
||||
ctrl.setGameMode(gameMode);
|
||||
}
|
||||
|
||||
private static String getFilePathFromUri(Uri uri) {
|
||||
if (uri == null)
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user