DroidFish: Added configurable button action to toggle arrow visibility.

This commit is contained in:
Peter Osterlund
2016-11-05 12:49:09 +01:00
parent 5fd10a8e54
commit 596e839eec
3 changed files with 27 additions and 2 deletions

View File

@@ -131,6 +131,7 @@ you are not actively using the program.\
<string name="toggle_analysis">Toggle Engine Analysis</string>
<string name="toggle_large_buttons">Toggle Large Buttons</string>
<string name="toggle_blind_mode">Toggle Blindfold Mode</string>
<string name="toggle_arrows">Toggle Arrows</string>
<string name="cancel">Cancel</string>
<string name="reset">Reset</string>
<string name="yes">Yes</string>
@@ -650,6 +651,7 @@ you are not actively using the program.\
<item>@string/toggle_pgn_headers</item>
<item>@string/toggle_large_buttons</item>
<item>@string/toggle_blind_mode</item>
<item>@string/toggle_arrows</item>
<item>@string/load_last_file</item>
<item>@string/select_engine</item>
<item>@string/engine_options</item>
@@ -665,6 +667,7 @@ you are not actively using the program.\
<item>viewHeaders</item>
<item>largeButtons</item>
<item>blindMode</item>
<item>toggleArrows</item>
<item>loadLastFile</item>
<item>selectEngine</item>
<item>engineOptions</item>

View File

@@ -344,7 +344,7 @@
android:title="@string/prefs_button_action_3_title"
android:entryValues="@array/button_action_values"
android:entries="@array/button_action_texts"
android:defaultValue="">
android:defaultValue="toggleArrows">
</ListPreference>
<ListPreference
android:key="button_action_custom1_4"

View File

@@ -405,6 +405,28 @@ public class DroidFish extends Activity
setEngineOptions();
}
});
addAction(new UIAction() {
public String getId() { return "toggleArrows"; }
public int getName() { return R.string.toggle_arrows; }
public int getIcon() { return R.raw.custom; }
public boolean enabled() { return true; }
public void run() {
String numArrows = settings.getString("thinkingArrows", "4");
Editor editor = settings.edit();
if (!numArrows.equals("0")) {
editor.putString("thinkingArrows", "0");
editor.putString("oldThinkingArrows", numArrows);
} else {
String oldNumArrows = settings.getString("oldThinkingArrows", "0");
if (oldNumArrows.equals("0"))
oldNumArrows = "4";
editor.putString("thinkingArrows", oldNumArrows);
}
editor.commit();
maxNumArrows = getIntSetting("thinkingArrows", 4);
updateThinkingInfo();
}
});
}
@Override
@@ -1138,7 +1160,7 @@ public class DroidFish extends Activity
numPV = settings.getInt("numPV", 1);
ctrl.setMultiPVMode(numPV);
mWhiteBasedScores = settings.getBoolean("whiteBasedScores", false);
maxNumArrows = getIntSetting("thinkingArrows", 2);
maxNumArrows = getIntSetting("thinkingArrows", 4);
mShowBookHints = settings.getBoolean("bookHints", false);
String engine = settings.getString("engine", "stockfish");