DroidFish: Implemented "toggle engine analysis" button action.

This commit is contained in:
Peter Osterlund
2012-05-13 06:32:36 +00:00
parent 84f28eaa12
commit 95d1e63338
3 changed files with 24 additions and 0 deletions

View File

@@ -272,6 +272,22 @@ public class DroidFish extends Activity implements GUIInterface {
ctrl.prefsChanged();
}
});
addAction(new UIAction() {
public String getId() { return "toggleAnalysis"; }
public int getName() { return R.string.toggle_analysis; }
public int getIcon(boolean large) { return -1; }
public boolean enabled() { return true; }
public void run() {
int gameModeType = ctrl.analysisMode() ? GameMode.EDIT_GAME : 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);
setBoardFlip(true);
}
});
}
@Override

View File

@@ -131,6 +131,11 @@ public class DroidChessController {
}
}
/** Return true if game mode is analysis. */
public final boolean analysisMode() {
return gameMode.analysisMode();
}
/** Set engine book options. */
public final synchronized void setBookOptions(BookOptions options) {
if (!bookOptions.equals(options)) {