mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 23:41:45 +02:00
Don't show soft input by default in input dialog
It takes time to open the soft input and with the new inc/dec buttons it should not be needed as much. If needed it is quickly summoned by clicking the input view. Also it doesn't look nice when the phone is in horizontal mode as then the soft input takes up the whole screen and one has to push back to get to the inc/dec buttons. See discussion in #222.
This commit is contained in:
@@ -75,11 +75,6 @@ public class CommentMeasurementView extends MeasurementView {
|
||||
return comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showSoftInputForInputDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getInputView() {
|
||||
EditText input = new EditText(getContext());
|
||||
@@ -91,7 +86,6 @@ public class CommentMeasurementView extends MeasurementView {
|
||||
input.setText(getValueAsString());
|
||||
input.setSelectAllOnFocus(true);
|
||||
|
||||
input.requestFocus();
|
||||
return input;
|
||||
}
|
||||
|
||||
|
@@ -91,11 +91,6 @@ public class DateMeasurementView extends MeasurementView {
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showSoftInputForInputDialog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getInputView() {
|
||||
DatePicker datePicker = new DatePicker(getContext());
|
||||
|
@@ -404,11 +404,6 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
showEvaluatorRow(show);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showSoftInputForInputDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private float validateAndGetInput(View view) {
|
||||
EditText editText = view.findViewById(R.id.float_input);
|
||||
String text = editText.getText().toString();
|
||||
@@ -441,7 +436,6 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
|
||||
final EditText input = view.findViewById(R.id.float_input);
|
||||
input.setText(formatValue(value));
|
||||
input.requestFocus();
|
||||
|
||||
final TextView unit = view.findViewById(R.id.float_input_unit);
|
||||
unit.setText(getUnit());
|
||||
|
@@ -381,7 +381,6 @@ public abstract class MeasurementView extends TableLayout {
|
||||
return openScale.getSelectedScaleUser();
|
||||
}
|
||||
|
||||
protected abstract boolean showSoftInputForInputDialog();
|
||||
protected abstract View getInputView();
|
||||
protected abstract boolean validateAndSetInput(View view);
|
||||
|
||||
@@ -400,15 +399,6 @@ public abstract class MeasurementView extends TableLayout {
|
||||
dialog.setTitle(getName());
|
||||
dialog.setIcon(getIcon());
|
||||
|
||||
final InputMethodManager imm = (InputMethodManager) getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (showSoftInputForInputDialog()) {
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
}
|
||||
else if (dialog.getCurrentFocus() != null) {
|
||||
imm.hideSoftInputFromWindow(dialog.getCurrentFocus().getWindowToken(), 0);
|
||||
}
|
||||
|
||||
final View input = getInputView();
|
||||
|
||||
FrameLayout fl = dialog.findViewById(android.R.id.custom);
|
||||
@@ -423,7 +413,6 @@ public abstract class MeasurementView extends TableLayout {
|
||||
&& !validateAndSetInput(input)) {
|
||||
return;
|
||||
}
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
dialog.dismiss();
|
||||
}
|
||||
};
|
||||
|
@@ -93,11 +93,6 @@ public class TimeMeasurementView extends MeasurementView {
|
||||
return timeFormat.format(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showSoftInputForInputDialog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getInputView() {
|
||||
TimePicker timePicker = new TimePicker(getContext());
|
||||
|
Reference in New Issue
Block a user