Add error message and name check
This commit is contained in:
parent
541ad88f01
commit
90268647da
2 changed files with 12 additions and 7 deletions
|
@ -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>
|
||||
|
|
|
@ -71,14 +71,18 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
String name = nameEditText.getText().toString();
|
||||
marker.setName(name);
|
||||
mapActivity.getMyApplication().getMapMarkersHelper().updateMapMarker(marker, true);
|
||||
FragmentManager fm = mapActivity.getSupportFragmentManager();
|
||||
Fragment fragment = fm.findFragmentByTag(MarkerMenuOnMapFragment.TAG);
|
||||
if (fragment != null) {
|
||||
((MarkerMenuOnMapFragment) fragment).dismiss();
|
||||
if (name.replaceAll("\\s", "").length() > 0) {
|
||||
marker.setName(name);
|
||||
mapActivity.getMyApplication().getMapMarkersHelper().updateMapMarker(marker, true);
|
||||
FragmentManager fm = mapActivity.getSupportFragmentManager();
|
||||
Fragment fragment = fm.findFragmentByTag(MarkerMenuOnMapFragment.TAG);
|
||||
if (fragment != null) {
|
||||
((MarkerMenuOnMapFragment) fragment).dismiss();
|
||||
}
|
||||
dismiss();
|
||||
} else {
|
||||
nameEditText.setError(getString(R.string.wrong_input));
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue