Merge pull request #9374 from osmandapp/Empty_favorite_name

Fix empty name
This commit is contained in:
Vitaliy 2020-07-02 19:06:34 +03:00 committed by GitHub
commit 6f6b6649e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -201,16 +201,11 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
@Override
public void afterTextChanged(Editable s) {
if (s.toString().trim().isEmpty()) {
nameCaption.setError(app.getString(R.string.please_provide_point_name_error));
saveButton.setEnabled(false);
} else {
nameCaption.setError(null);
saveButton.setEnabled(true);
}
checkEmptyName(s, nameCaption, saveButton);
}
});
checkEmptyName(nameEdit.getText(), nameCaption, saveButton);
nameIcon = (ImageView) view.findViewById(R.id.name_icon);
TextView categoryEdit = view.findViewById(R.id.groupName);
if (categoryEdit != null) {
@ -312,6 +307,16 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
return view;
}
private void checkEmptyName(Editable name, TextInputLayout nameCaption, View saveButton) {
if (name.toString().trim().isEmpty()) {
nameCaption.setError(app.getString(R.string.please_provide_point_name_error));
saveButton.setEnabled(false);
} else {
nameCaption.setError(null);
saveButton.setEnabled(true);
}
}
private ViewTreeObserver.OnGlobalLayoutListener getOnGlobalLayoutListener() {
return new ViewTreeObserver.OnGlobalLayoutListener() {
@Override