change showSoftKeyboard to softKeyboardDelayed and fix empty point name

This commit is contained in:
Chumva 2018-06-26 14:15:37 +03:00
parent 97ef7b8a8a
commit 6c449c7410
2 changed files with 11 additions and 22 deletions

View file

@ -10,6 +10,7 @@
- For wording and consistency, please note http://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience
Thx - Hardy
-->
<string name="coord_input_point_deleted">Point %1$s deleted</string>
<string name="coord_input_edit_point">Edit point</string>
<string name="coord_input_add_point">Add point</string>
<string name="coord_input_save_as_track">Save as track</string>

View file

@ -362,13 +362,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
}
final View focusedView = getDialog().getCurrentFocus();
if (focusedView != null) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
isSoftKeyboardShown = true;
AndroidUtils.showSoftKeyboard(focusedView);
}
}, 200);
AndroidUtils.softKeyboardDelayed(focusedView);
isSoftKeyboardShown = true;
}
}
});
@ -618,13 +613,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
final View focusedView = getDialog().getCurrentFocus();
if (focusedView != null) {
if (!isOsmandKeyboardOn()) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
isSoftKeyboardShown = true;
AndroidUtils.showSoftKeyboard(focusedView);
}
}, 200);
isSoftKeyboardShown = true;
AndroidUtils.softKeyboardDelayed(focusedView);
}
}
}
@ -953,13 +943,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
AndroidUtils.hideSoftKeyboard(getActivity(), focusedView);
isSoftKeyboardShown = false;
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AndroidUtils.showSoftKeyboard(focusedView);
isSoftKeyboardShown = true;
}
}, 200);
AndroidUtils.softKeyboardDelayed(focusedView);
isSoftKeyboardShown = true;
}
}
changeEditTextSelections();
@ -1041,7 +1026,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
}
adapter.removeItem(position);
hasUnsavedChanges = true;
snackbar = Snackbar.make(mainView, R.string.marker_moved_to_history, Snackbar.LENGTH_LONG)
snackbar = Snackbar.make(mainView, getString(R.string.coord_input_point_deleted, wpt.name), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -1237,6 +1222,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
double lat = parseCoordinate(latitude);
double lon = parseCoordinate(longitude);
String name = ((EditText) mainView.findViewById(R.id.point_name_et)).getText().toString();
if (name.trim().isEmpty()) {
name = getString(R.string.short_location_on_map, latitude, longitude).replace('\n', ' ');
}
if (selectedWpt != null) {
updateWpt(getGpx(), null, name, null, 0, lat, lon);
dismissEditingMode();