Add error message and name check

This commit is contained in:
Alexander Sytnyk 2017-10-20 13:29:59 +03:00
parent 541ad88f01
commit 90268647da
2 changed files with 12 additions and 7 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="wrong_input">Wrong input</string>
<string name="enter_new_name">Enter new name</string>
<string name="shared_string_back">Back</string>
<string name="wrong_format">Wrong format</string>

View file

@ -71,6 +71,7 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
@Override
public void onClick(View view) {
String name = nameEditText.getText().toString();
if (name.replaceAll("\\s", "").length() > 0) {
marker.setName(name);
mapActivity.getMyApplication().getMapMarkersHelper().updateMapMarker(marker, true);
FragmentManager fm = mapActivity.getSupportFragmentManager();
@ -79,6 +80,9 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
((MarkerMenuOnMapFragment) fragment).dismiss();
}
dismiss();
} else {
nameEditText.setError(getString(R.string.wrong_input));
}
}
});