mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-18 19:52:19 +01:00
DroidFish: Implemented "toggle engine analysis" button action.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user