Code reformatting

This commit is contained in:
Peter Osterlund 2019-04-24 23:25:13 +02:00
parent 068b97ac85
commit 5d599c2782
5 changed files with 209 additions and 215 deletions

11
.editorconfig Normal file
View 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

View File

@ -119,12 +119,8 @@ public class EditOptions extends Activity {
if (so.minValue >= 0)
holder.eoValue.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
holder.eoValue.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) { }
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void afterTextChanged(Editable s) {
try {
@ -147,8 +143,7 @@ public class EditOptions extends Activity {
holder.eoLabel.setText(o.name);
final UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
ArrayAdapter<CharSequence> adapter =
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item,
co.allowedValues);
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, co.allowedValues);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
holder.eoValue.setAdapter(adapter);
holder.eoValue.setSelection(adapter.getPosition(co.value));
@ -159,8 +154,7 @@ public class EditOptions extends Activity {
co.set(co.allowedValues[position]);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
public void onNothingSelected(AdapterView<?> arg0) { }
});
binding.eoContent.addView(holder.getRoot());
break;
@ -182,12 +176,8 @@ public class EditOptions extends Activity {
final UCIOptions.StringOption so = (UCIOptions.StringOption) o;
holder.eoValue.setText(so.value);
holder.eoValue.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) { }
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void afterTextChanged(Editable s) {
so.set(s.toString());
@ -217,26 +207,22 @@ public class EditOptions extends Activity {
switch (o.type) {
case CHECK: {
UCIOptions.CheckOption co = (UCIOptions.CheckOption) o;
if (co.set(co.defaultValue))
modified = true;
modified |= co.set(co.defaultValue);
break;
}
case SPIN: {
UCIOptions.SpinOption so = (UCIOptions.SpinOption) o;
if (so.set(so.defaultValue))
modified = true;
modified |= so.set(so.defaultValue);
break;
}
case COMBO: {
UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
if (co.set(co.defaultValue))
modified = true;
modified |= co.set(co.defaultValue);
break;
}
case STRING: {
UCIOptions.StringOption so = (UCIOptions.StringOption) o;
if (so.set(so.defaultValue))
modified = true;
modified |= so.set(so.defaultValue);
break;
}
case BUTTON:

View File

@ -271,12 +271,10 @@ public abstract class EditPGN extends ListActivity {
binding.selectGameFilter.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
}
public void afterTextChanged(Editable s) { }
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

View File

@ -40,9 +40,7 @@ import org.petero.droidfish.databinding.SelectPercentageBinding;
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 {
private final static int maxValue = 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);
}
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 = () -> {
try {
String txt = selectPercentageBinding.selpercentageNumber.getText().toString();