fix two keyboards in point_name_et
This commit is contained in:
parent
b33923ca19
commit
b0db8cd235
1 changed files with 20 additions and 7 deletions
|
@ -286,6 +286,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
isSoftKeyboardShown = true;
|
||||||
AndroidUtils.showSoftKeyboard(focusedView);
|
AndroidUtils.showSoftKeyboard(focusedView);
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
|
@ -691,6 +692,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
if (isOsmandKeyboardOn()) {
|
if (isOsmandKeyboardOn()) {
|
||||||
if (!isOsmandKeyboardCurrentlyVisible()) {
|
if (!isOsmandKeyboardCurrentlyVisible()) {
|
||||||
|
if (isSoftKeyboardShown) {
|
||||||
|
if (view.getId() != R.id.point_name_et) {
|
||||||
|
AndroidUtils.hideSoftKeyboard(getActivity(), view);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
changeOsmandKeyboardVisibility(true);
|
changeOsmandKeyboardVisibility(true);
|
||||||
}
|
}
|
||||||
EditText editText = (EditText) view;
|
EditText editText = (EditText) view;
|
||||||
|
@ -820,8 +828,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
et.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
et.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
if (!hasFocus && isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
|
if (!hasFocus && isOsmandKeyboardOn() && (isOsmandKeyboardCurrentlyVisible() || isSoftKeyboardShown)) {
|
||||||
AndroidUtils.hideSoftKeyboard(getActivity(), v);
|
AndroidUtils.hideSoftKeyboard(getActivity(), v);
|
||||||
|
isSoftKeyboardShown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1082,15 +1091,19 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showKeyboard() {
|
private void showKeyboard() {
|
||||||
|
View focusedView = null;
|
||||||
for (EditText et : editTexts) {
|
for (EditText et : editTexts) {
|
||||||
if (et.getId() == R.id.lat_first_input_et) {
|
if (et.getId() == R.id.lat_first_input_et) {
|
||||||
et.requestFocus();
|
et.requestFocus();
|
||||||
|
focusedView = getDialog().getCurrentFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isOsmandKeyboardOn()) {
|
if (isOsmandKeyboardOn()) {
|
||||||
|
if (!isOsmandKeyboardCurrentlyVisible()) {
|
||||||
changeOsmandKeyboardVisibility(true);
|
changeOsmandKeyboardVisibility(true);
|
||||||
} else {
|
|
||||||
AndroidUtils.softKeyboardDelayed(et);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else if (!isSoftKeyboardShown && focusedView != null) {
|
||||||
|
AndroidUtils.softKeyboardDelayed(focusedView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1246,7 +1259,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
et.clearFocus();
|
et.clearFocus();
|
||||||
}
|
}
|
||||||
if (editTexts.size() > 0) {
|
if (editTexts.size() > 0) {
|
||||||
editTexts.get(0).requestFocus();
|
showKeyboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue