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:
Peter Osterlund
2012-01-07 08:19:14 +00:00
parent 441b6bc59a
commit 42a71b0ec5
4 changed files with 35 additions and 7 deletions

View File

@@ -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);
}
}
}

View File

@@ -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() {