DroidFish: Fixed crash when rotating screen while editing UCI options.

This commit is contained in:
Peter Osterlund 2015-12-20 13:58:46 +01:00
parent 7873d05541
commit 280bdfc5a1
2 changed files with 13 additions and 8 deletions

View File

@ -118,7 +118,7 @@
android:label="@string/cpu_warning_title"> android:label="@string/cpu_warning_title">
</activity> </activity>
<activity android:name=".activities.EditOptions" <activity android:name=".activities.EditOptions"
android:configChanges="orientation"> android:configChanges="orientation|screenSize">
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -87,16 +87,15 @@ public class EditOptions extends Activity {
} }
private final void initUI() { private final void initUI() {
setContentView(R.layout.editoptions); String title = getString(R.string.edit_options_title);
Util.overrideFonts(findViewById(android.R.id.content)); if (engineName != null)
setTitle(getString(R.string.edit_options_title) + ": " + engineName); title = title + ": " + engineName;
setTitle(title);
LinearLayout content = (LinearLayout)findViewById(R.id.eo_content); View view = View.inflate(this, R.layout.editoptions, null);
Button okButton = (Button)findViewById(R.id.eo_ok);
Button cancelButton = (Button)findViewById(R.id.eo_cancel);
Button resetButton = (Button)findViewById(R.id.eo_reset);
if (uciOpts != null) { if (uciOpts != null) {
LinearLayout content = (LinearLayout)view.findViewById(R.id.eo_content);
for (String name : uciOpts.getOptionNames()) { for (String name : uciOpts.getOptionNames()) {
UCIOptions.OptionBase o = uciOpts.getOption(name); UCIOptions.OptionBase o = uciOpts.getOption(name);
if (!o.visible) if (!o.visible)
@ -209,6 +208,12 @@ public class EditOptions extends Activity {
} }
} }
setContentView(view);
Util.overrideFonts(findViewById(android.R.id.content));
Button okButton = (Button)findViewById(R.id.eo_ok);
Button cancelButton = (Button)findViewById(R.id.eo_cancel);
Button resetButton = (Button)findViewById(R.id.eo_reset);
okButton.setOnClickListener(new OnClickListener() { okButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {