mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-19 12:12:17 +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:
@@ -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