mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
Code reformatting
This commit is contained in:
parent
068b97ac85
commit
5d599c2782
11
.editorconfig
Normal file
11
.editorconfig
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[*]
|
||||||
|
charset=utf-8
|
||||||
|
end_of_line=lf
|
||||||
|
insert_final_newline=true
|
||||||
|
indent_style=space
|
||||||
|
indent_size=4
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
|
@ -119,12 +119,8 @@ public class EditOptions extends Activity {
|
||||||
if (so.minValue >= 0)
|
if (so.minValue >= 0)
|
||||||
holder.eoValue.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
|
holder.eoValue.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
|
||||||
holder.eoValue.addTextChangedListener(new TextWatcher() {
|
holder.eoValue.addTextChangedListener(new TextWatcher() {
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
||||||
}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||||
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
try {
|
try {
|
||||||
|
@ -147,8 +143,7 @@ public class EditOptions extends Activity {
|
||||||
holder.eoLabel.setText(o.name);
|
holder.eoLabel.setText(o.name);
|
||||||
final UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
|
final UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
|
||||||
ArrayAdapter<CharSequence> adapter =
|
ArrayAdapter<CharSequence> adapter =
|
||||||
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item,
|
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, co.allowedValues);
|
||||||
co.allowedValues);
|
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
holder.eoValue.setAdapter(adapter);
|
holder.eoValue.setAdapter(adapter);
|
||||||
holder.eoValue.setSelection(adapter.getPosition(co.value));
|
holder.eoValue.setSelection(adapter.getPosition(co.value));
|
||||||
|
@ -159,8 +154,7 @@ public class EditOptions extends Activity {
|
||||||
co.set(co.allowedValues[position]);
|
co.set(co.allowedValues[position]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> arg0) {
|
public void onNothingSelected(AdapterView<?> arg0) { }
|
||||||
}
|
|
||||||
});
|
});
|
||||||
binding.eoContent.addView(holder.getRoot());
|
binding.eoContent.addView(holder.getRoot());
|
||||||
break;
|
break;
|
||||||
|
@ -182,12 +176,8 @@ public class EditOptions extends Activity {
|
||||||
final UCIOptions.StringOption so = (UCIOptions.StringOption) o;
|
final UCIOptions.StringOption so = (UCIOptions.StringOption) o;
|
||||||
holder.eoValue.setText(so.value);
|
holder.eoValue.setText(so.value);
|
||||||
holder.eoValue.addTextChangedListener(new TextWatcher() {
|
holder.eoValue.addTextChangedListener(new TextWatcher() {
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
||||||
}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||||
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
so.set(s.toString());
|
so.set(s.toString());
|
||||||
|
@ -217,26 +207,22 @@ public class EditOptions extends Activity {
|
||||||
switch (o.type) {
|
switch (o.type) {
|
||||||
case CHECK: {
|
case CHECK: {
|
||||||
UCIOptions.CheckOption co = (UCIOptions.CheckOption) o;
|
UCIOptions.CheckOption co = (UCIOptions.CheckOption) o;
|
||||||
if (co.set(co.defaultValue))
|
modified |= co.set(co.defaultValue);
|
||||||
modified = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPIN: {
|
case SPIN: {
|
||||||
UCIOptions.SpinOption so = (UCIOptions.SpinOption) o;
|
UCIOptions.SpinOption so = (UCIOptions.SpinOption) o;
|
||||||
if (so.set(so.defaultValue))
|
modified |= so.set(so.defaultValue);
|
||||||
modified = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COMBO: {
|
case COMBO: {
|
||||||
UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
|
UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
|
||||||
if (co.set(co.defaultValue))
|
modified |= co.set(co.defaultValue);
|
||||||
modified = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRING: {
|
case STRING: {
|
||||||
UCIOptions.StringOption so = (UCIOptions.StringOption) o;
|
UCIOptions.StringOption so = (UCIOptions.StringOption) o;
|
||||||
if (so.set(so.defaultValue))
|
modified |= so.set(so.defaultValue);
|
||||||
modified = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BUTTON:
|
case BUTTON:
|
||||||
|
|
|
@ -271,12 +271,10 @@ public abstract class EditPGN extends ListActivity {
|
||||||
|
|
||||||
binding.selectGameFilter.addTextChangedListener(new TextWatcher() {
|
binding.selectGameFilter.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) { }
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
|
@ -40,9 +40,7 @@ import org.petero.droidfish.databinding.SelectPercentageBinding;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/** Lets user enter a percentage value using a seek bar. */
|
||||||
* Lets user enter a percentage value using a seek bar.
|
|
||||||
*/
|
|
||||||
public class SeekBarPreference extends Preference implements OnSeekBarChangeListener {
|
public class SeekBarPreference extends Preference implements OnSeekBarChangeListener {
|
||||||
private final static int maxValue = 1000;
|
private final static int maxValue = 1000;
|
||||||
private final static int DEFAULT_VALUE = 1000;
|
private final static int DEFAULT_VALUE = 1000;
|
||||||
|
@ -99,7 +97,8 @@ public class SeekBarPreference extends Preference implements OnSeekBarChangeList
|
||||||
title = getContext().getString(R.string.edit_randomization);
|
title = getContext().getString(R.string.edit_randomization);
|
||||||
}
|
}
|
||||||
builder.setTitle(title);
|
builder.setTitle(title);
|
||||||
selectPercentageBinding.selpercentageNumber.setText(binding.seekbarValue.getText().toString().replaceAll("%", "").replaceAll(",", "."));
|
String s = binding.seekbarValue.getText().toString().replaceAll("%", "").replaceAll(",", ".");
|
||||||
|
selectPercentageBinding.selpercentageNumber.setText(s);
|
||||||
final Runnable selectValue = () -> {
|
final Runnable selectValue = () -> {
|
||||||
try {
|
try {
|
||||||
String txt = selectPercentageBinding.selpercentageNumber.getText().toString();
|
String txt = selectPercentageBinding.selpercentageNumber.getText().toString();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user