mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-19 20:22:18 +01:00
DroidFish: Clarified that not all engine options work for all engines. Display the current engine in the program title bar.
This commit is contained in:
@@ -443,10 +443,11 @@ you are not actively using the program.\
|
||||
<string name="prefs_autoSwapSides_summary">Automatically swap sides when new game started. Also overrides Flip Board setting</string>
|
||||
<string name="prefs_engine_settings">Engine Settings</string>
|
||||
<string name="prefs_strength_title">Strength</string>
|
||||
<string name="prefs_strength_summary">Only supported by internal engines</string>
|
||||
<string name="prefs_ponderMode_title">Pondering</string>
|
||||
<string name="prefs_ponderMode_summary">Let engine think while waiting for opponent\'s move</string>
|
||||
<string name="prefs_ponderMode_summary">Let engine think while waiting for opponent\'s move. Supported by most engines.</string>
|
||||
<string name="prefs_threads_title">Threads</string>
|
||||
<string name="prefs_threads_summary">Number of engine threads (CPU cores) to use</string>
|
||||
<string name="prefs_threads_summary">Number of engine threads (CPU cores) to use. Not supported by all engines.</string>
|
||||
<string name="prefs_time_control">Time Control</string>
|
||||
<string name="prefs_movesPerSession_title">Moves</string>
|
||||
<string name="prefs_movesPerSession_summary">Number of moves between time controls</string>
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
android:title="@string/prefs_engine_settings">
|
||||
<org.petero.droidfish.SeekBarPreference
|
||||
android:key="strength"
|
||||
android:defaultValue="1000"
|
||||
android:title="@string/prefs_strength_title">
|
||||
android:title="@string/prefs_strength_title"
|
||||
android:summary="@string/prefs_strength_summary"
|
||||
android:defaultValue="1000">
|
||||
</org.petero.droidfish.SeekBarPreference>
|
||||
<CheckBoxPreference
|
||||
android:key="ponderMode"
|
||||
|
||||
@@ -643,10 +643,19 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
|
||||
private final void setEngineStrength(String engine, int strength) {
|
||||
ctrl.setEngineStrength(engine, strength);
|
||||
if (strength < 1000) {
|
||||
titleText.setText(String.format("%s: %d%%", getString(R.string.app_name), strength / 10));
|
||||
if (engine.contains("/")) {
|
||||
int idx = engine.lastIndexOf('/');
|
||||
String eName = engine.substring(idx + 1);
|
||||
titleText.setText(eName);
|
||||
} else {
|
||||
titleText.setText(getString(R.string.app_name));
|
||||
String eName = getString((engine == "cuckoochess") ?
|
||||
R.string.cuckoochess_engine :
|
||||
R.string.stockfish_engine);
|
||||
if (strength < 1000) {
|
||||
titleText.setText(String.format("%s:%d%%", eName, strength / 10));
|
||||
} else {
|
||||
titleText.setText(eName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,11 +94,28 @@ public class SeekBarPreference extends Preference
|
||||
lp.gravity = Gravity.RIGHT;
|
||||
bar.setLayoutParams(lp);
|
||||
|
||||
CharSequence summaryCharSeq = getSummary();
|
||||
boolean haveSummary = (summaryCharSeq != null) && (summaryCharSeq.length() > 0);
|
||||
TextView summary = null;
|
||||
if (haveSummary) {
|
||||
summary = new TextView(getContext());
|
||||
summary.setText(getSummary());
|
||||
// summary.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
|
||||
summary.setGravity(Gravity.LEFT);
|
||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
lp.gravity = Gravity.LEFT;
|
||||
lp.weight = 1.0f;
|
||||
summary.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
LinearLayout layout = new LinearLayout(getContext());
|
||||
layout.setPadding(25, 5, 25, 5);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
layout.addView(row1);
|
||||
layout.addView(bar);
|
||||
if (summary != null)
|
||||
layout.addView(summary);
|
||||
layout.setId(android.R.id.widget_frame);
|
||||
|
||||
currValBox.setOnClickListener(new OnClickListener() {
|
||||
|
||||
Reference in New Issue
Block a user