mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-03-25 14:45:07 +01:00
DroidFish: Implemented function to reset all UCI options to default values.
This commit is contained in:
parent
d0648b9cbf
commit
0e9e6fb18b
@ -34,5 +34,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
</Button>
|
||||
<Button
|
||||
android:text="@string/reset"
|
||||
android:id="@+id/eo_reset"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -33,5 +33,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
</Button>
|
||||
<Button
|
||||
android:text="@string/reset"
|
||||
android:id="@+id/eo_reset"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -130,6 +130,7 @@ you are not actively using the program.\
|
||||
<string name="toggle_large_buttons">Toggle Large Buttons</string>
|
||||
<string name="toggle_blind_mode">Toggle Blindfold Mode</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="reset">Reset</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
<string name="move_number">Move number:</string>
|
||||
|
@ -93,7 +93,9 @@ public class EditOptions extends Activity {
|
||||
LinearLayout content = (LinearLayout)findViewById(R.id.eo_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);
|
||||
|
||||
if (uciOpts != null) {
|
||||
for (String name : uciOpts.getOptionNames()) {
|
||||
UCIOptions.OptionBase o = uciOpts.getOption(name);
|
||||
if (!o.visible)
|
||||
@ -204,6 +206,7 @@ public class EditOptions extends Activity {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
okButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@ -218,6 +221,47 @@ public class EditOptions extends Activity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
resetButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uciOpts != null) {
|
||||
boolean modified = false;
|
||||
for (String name : uciOpts.getOptionNames()) {
|
||||
UCIOptions.OptionBase o = uciOpts.getOption(name);
|
||||
if (!o.visible)
|
||||
continue;
|
||||
switch (o.type) {
|
||||
case CHECK: {
|
||||
UCIOptions.CheckOption co = (UCIOptions.CheckOption)o;
|
||||
if (co.set(co.defaultValue))
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
case SPIN: {
|
||||
UCIOptions.SpinOption so = (UCIOptions.SpinOption)o;
|
||||
if (so.set(so.defaultValue))
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
case COMBO: {
|
||||
UCIOptions.ComboOption co = (UCIOptions.ComboOption)o;
|
||||
if (co.set(co.defaultValue))
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
case STRING: {
|
||||
UCIOptions.StringOption so = (UCIOptions.StringOption)o;
|
||||
if (so.set(so.defaultValue))
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modified)
|
||||
initUI();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final void sendBackResult() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user