Merge pull request #9831 from osmandapp/edit_address_oncreate

Address doesn't saved if it enters manualy while adding favorite
This commit is contained in:
vshcherb 2020-09-17 12:40:19 +02:00 committed by GitHub
commit 02c20183f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View file

@ -307,7 +307,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FavoritePointEditor editor = getFavoritePointEditor(); FavoritePointEditor editor = getFavoritePointEditor();
if (editor != null && helper != null) { if (editor != null && helper != null) {
if (editor.isNew()) { if (editor.isNew()) {
doAddFavorite(name, category, description, color, backgroundType, iconId); doAddFavorite(name, category, description, address, color, backgroundType, iconId);
} else { } else {
doEditFavorite(favorite, name, category, description, address, color, backgroundType, iconId, helper); doEditFavorite(favorite, name, category, description, address, color, backgroundType, iconId, helper);
} }
@ -341,7 +341,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
} }
} }
private void doAddFavorite(String name, String category, String description, @ColorInt int color, private void doAddFavorite(String name, String category, String description, String address, @ColorInt int color,
BackgroundType backgroundType, @DrawableRes int iconId) { BackgroundType backgroundType, @DrawableRes int iconId) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
FavouritesDbHelper helper = getHelper(); FavouritesDbHelper helper = getHelper();
@ -350,6 +350,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
favorite.setName(name); favorite.setName(name);
favorite.setCategory(category); favorite.setCategory(category);
favorite.setDescription(description); favorite.setDescription(description);
favorite.setAddress(address);
favorite.setColor(color); favorite.setColor(color);
favorite.setBackgroundType(backgroundType); favorite.setBackgroundType(backgroundType);
favorite.setIconId(iconId); favorite.setIconId(iconId);

View file

@ -817,11 +817,15 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
hideKeyboard(); hideKeyboard();
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
MapContextMenu mapContextMenu = mapActivity.getContextMenu();
if (includingMenu) { if (includingMenu) {
mapActivity.getSupportFragmentManager().popBackStack(); mapActivity.getSupportFragmentManager().popBackStack();
mapActivity.getContextMenu().close(); mapContextMenu.close();
} else { } else {
mapActivity.getSupportFragmentManager().popBackStack(); mapActivity.getSupportFragmentManager().popBackStack();
if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
mapContextMenu.show();
}
} }
} }
} }
@ -932,17 +936,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private void exitEditing() { private void exitEditing() {
cancelled = true; cancelled = true;
dismiss(); dismiss();
showContextMenu();
}
private void showContextMenu() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
MapContextMenu mapContextMenu = mapActivity.getContextMenu();
if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
mapContextMenu.show();
}
}
} }
private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) { private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) {