diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index 3bd2a0f..7b7b03a 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -887,6 +887,10 @@ public class DroidFish extends Activity implements GUIInterface { private final void setEngineStrength(String engine, int strength) { ctrl.setEngineStrength(engine, strength); + setEngineTitle(engine, strength); + } + + private final void setEngineTitle(String engine, int strength) { if (engine.contains("/")) { int idx = engine.lastIndexOf('/'); String eName = engine.substring(idx + 1); @@ -897,7 +901,8 @@ public class DroidFish extends Activity implements GUIInterface { String eName = getString(engine.equals("cuckoochess") ? R.string.cuckoochess_engine : R.string.stockfish_engine); - if (strength < 1000) { + boolean analysis = (ctrl != null) && ctrl.analysisMode(); + if ((strength < 1000) && !analysis) { engineTitleText.setText(String.format("%s: %d%%", eName, strength / 10)); } else { engineTitleText.setText(eName); @@ -905,6 +910,13 @@ public class DroidFish extends Activity implements GUIInterface { } } + @Override + public void updateEngineTitle() { + String engine = settings.getString("engine", "stockfish"); + int strength = settings.getInt("strength", 1000); + setEngineTitle(engine, strength); + } + private final void setFullScreenMode(boolean fullScreenMode) { WindowManager.LayoutParams attrs = getWindow().getAttributes(); if (fullScreenMode) { @@ -1388,6 +1400,7 @@ public class DroidFish extends Activity implements GUIInterface { ctrl.newGame(gameMode); ctrl.startGame(); setBoardFlip(true); + updateEngineTitle(); } static private final int PROMOTE_DIALOG = 0; diff --git a/DroidFish/src/org/petero/droidfish/GUIInterface.java b/DroidFish/src/org/petero/droidfish/GUIInterface.java index 0b66540..93f6783 100644 --- a/DroidFish/src/org/petero/droidfish/GUIInterface.java +++ b/DroidFish/src/org/petero/droidfish/GUIInterface.java @@ -77,6 +77,9 @@ public interface GUIInterface { /** Report remaining thinking time to GUI. */ public void setRemainingTime(long wTime, long bTime, long nextUpdate); + /** Update engine title text. */ + public void updateEngineTitle(); + /** Report a move made that is a candidate for GUI animation. */ public void setAnimMove(Position sourcePos, Move move, boolean forward); diff --git a/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java b/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java index 264ca6a..363a36e 100644 --- a/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java +++ b/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java @@ -128,6 +128,7 @@ public class DroidChessController { updateGameMode(); abortSearch(); updateComputeThreads(); + gui.updateEngineTitle(); updateGUI(); } }