Switch to next field due to accuracy
This commit is contained in:
parent
cddb6ee3f8
commit
f12743827c
1 changed files with 14 additions and 8 deletions
|
@ -355,13 +355,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
|
|
||||||
private void registerInputTextViews() {
|
private void registerInputTextViews() {
|
||||||
TextWatcher textWatcher = new TextWatcher() {
|
TextWatcher textWatcher = new TextWatcher() {
|
||||||
int len = 0;
|
|
||||||
String strBeforeChanging = "";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
len = charSequence.length();
|
|
||||||
strBeforeChanging = charSequence.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -371,10 +368,19 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
View focusedView = getDialog().getCurrentFocus();
|
if (goToNextField) {
|
||||||
if (focusedView != null && focusedView instanceof EditText) {
|
View focusedView = getDialog().getCurrentFocus();
|
||||||
EditText focusedEditText = (EditText) focusedView;
|
if (focusedView != null && focusedView instanceof EditText) {
|
||||||
String str = focusedEditText.getText().toString();
|
EditText focusedEditText = (EditText) focusedView;
|
||||||
|
String str = focusedEditText.getText().toString();
|
||||||
|
int pointIndex = str.indexOf(".");
|
||||||
|
if (pointIndex != -1) {
|
||||||
|
int currentAccuracy = str.substring(pointIndex + 1).length();
|
||||||
|
if (currentAccuracy >= accuracy) {
|
||||||
|
switchToNextInput(focusedEditText.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue