From 1509301779c508d975f193881ad64ec8d9cdb3e5 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Fri, 11 Sep 2020 23:03:07 +0200 Subject: [PATCH 01/29] Improve bug templates --- .github/ISSUE_TEMPLATE/2-faq-report.md | 2 +- .github/ISSUE_TEMPLATE/3-bug-report.md | 18 ++++++++++-------- .github/ISSUE_TEMPLATE/4-routing-report.md | 14 ++++++++++---- .github/ISSUE_TEMPLATE/5-feature-request.md | 9 +++++---- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/2-faq-report.md b/.github/ISSUE_TEMPLATE/2-faq-report.md index fbc18c4381..531d263d7f 100644 --- a/.github/ISSUE_TEMPLATE/2-faq-report.md +++ b/.github/ISSUE_TEMPLATE/2-faq-report.md @@ -1,8 +1,8 @@ --- name: "📚 Outdated FAQ" about: Report an issue in FAQ - --- + 🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑 Please do not file FAQ issues on the GitHub issues tracker. diff --git a/.github/ISSUE_TEMPLATE/3-bug-report.md b/.github/ISSUE_TEMPLATE/3-bug-report.md index d12ea14578..ecf870be10 100644 --- a/.github/ISSUE_TEMPLATE/3-bug-report.md +++ b/.github/ISSUE_TEMPLATE/3-bug-report.md @@ -2,6 +2,7 @@ name: "\U0001F41E Bug report" about: Report a bug in OsmAnd --- + Yes, the previous version in which this bug was not present was: .... - ### Description - A clear and concise description of the problem... - + ## 🔬 Minimal Reproduction + 1. Open app, and click on ... ## 🔥 Exception or Error +

 
 
 
 
- -## 🌍 Your Environment +## 🌍 Your Environment **OsmAnd Version:** +

 
 
@@ -60,10 +61,11 @@ If the bug is reproducible, please describe steps below:
 **Device and Android/iOS version:**
 
 **Maps used (online or offline):**
+
 
-- [ ] Offline maps offered within the OsmAnd app for download. 
-  
+
+- [ ] Offline maps offered within the OsmAnd app for download.
+
 - [ ] Online (tile / raster) maps 
 
-
 **Anything else relevant?**
diff --git a/.github/ISSUE_TEMPLATE/4-routing-report.md b/.github/ISSUE_TEMPLATE/4-routing-report.md
index 4c1e68c11a..216cd4b402 100644
--- a/.github/ISSUE_TEMPLATE/4-routing-report.md
+++ b/.github/ISSUE_TEMPLATE/4-routing-report.md
@@ -2,6 +2,7 @@
 name: "\U0001F6A9 Routing report"
 about: Report a routing issue in OsmAnd
 ---
+
 
+
 - [ ] OsmAnd's in-app offline routing
 - [ ] Any online routing provider (YOURS, OpenRouteService, OSRM, etc.)
 
 ### Routing Profile
+
 
 
 ### Start and end points
@@ -38,6 +41,7 @@ Please give us the following information so that we can try to **reproduce** you
 Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can be helpful. -->
 
 ### Actual and expected routes
+
 
 
 ### Is this a regression?
@@ -45,9 +49,10 @@ Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can b
 
  Yes, the previous version in which this bug was not present was: ....
 
-## 🌍  Your Environment
+## 🌍 Your Environment
 
 **OsmAnd Version:**
+
 

 
 
@@ -57,10 +62,11 @@ Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can b
 **Device and Android/iOS version:**
 
 **Maps used (online or offline):**
+
 
-- [ ] Offline maps offered within the OsmAnd app for download. 
-  
+
+- [ ] Offline maps offered within the OsmAnd app for download.
+
 - [ ] Online (tile / raster) maps 
 
-
 **Anything else relevant?**
diff --git a/.github/ISSUE_TEMPLATE/5-feature-request.md b/.github/ISSUE_TEMPLATE/5-feature-request.md
index 046fb3a90f..9c46069f8c 100644
--- a/.github/ISSUE_TEMPLATE/5-feature-request.md
+++ b/.github/ISSUE_TEMPLATE/5-feature-request.md
@@ -1,11 +1,11 @@
 ---
 name: "\U0001F680 Feature request"
 about: Suggest a feature for OsmAnd
-
 ---
+
  A clear and concise description of the problem or missing capability...
 
+
 
 ### Describe the solution you'd like
+
  If you have a solution in mind, please describe it.
 
-
 ### Describe alternatives you've considered
+
  Have you considered any alternative solutions or workarounds?

From 2ca2e5a554b85d404b63deb982b3a21df96dba8d Mon Sep 17 00:00:00 2001
From: Dima-1 
Date: Sun, 13 Sep 2020 13:54:31 +0300
Subject: [PATCH 02/29] Close #9746 Request: Replace saving dialog in Route
 Details > Save

---
 OsmAnd/src/net/osmand/FileUtils.java          | 22 ++++++++
 .../plus/activities/MapActivityActions.java   | 31 ++++++----
 .../MeasurementToolFragment.java              | 17 +-----
 ...veAsNewTrackBottomSheetDialogFragment.java | 56 ++++++++++++-------
 .../ChooseRouteFragment.java                  | 37 ++++++++++--
 5 files changed, 114 insertions(+), 49 deletions(-)

diff --git a/OsmAnd/src/net/osmand/FileUtils.java b/OsmAnd/src/net/osmand/FileUtils.java
index 661bf81f75..222b706e3c 100644
--- a/OsmAnd/src/net/osmand/FileUtils.java
+++ b/OsmAnd/src/net/osmand/FileUtils.java
@@ -19,8 +19,14 @@ import net.osmand.util.Algorithms;
 
 import java.io.File;
 import java.lang.ref.WeakReference;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
 import java.util.regex.Pattern;
 
+import static net.osmand.IndexConstants.GPX_FILE_EXT;
+import static net.osmand.IndexConstants.GPX_INDEX_DIR;
+
 public class FileUtils {
 
 	public static final Pattern ILLEGAL_FILE_NAME_CHARACTERS = Pattern.compile("[?:\"*|/<>]");
@@ -165,6 +171,22 @@ public class FileUtils {
 		return dest;
 	}
 
+	public static String createName(OsmandApplication app) {
+		String displayedName;
+		final String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
+		displayedName = suggestedName;
+		if (app != null) {
+			File dir = app.getAppPath(GPX_INDEX_DIR);
+			File fout = new File(dir, suggestedName + GPX_FILE_EXT);
+			int ind = 0;
+			while (fout.exists()) {
+				displayedName = suggestedName + "_" + (++ind);
+				fout = new File(dir, displayedName + GPX_FILE_EXT);
+			}
+		}
+		return displayedName;
+	}
+
 	public interface RenameCallback {
 		void renamedTo(File file);
 	}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index d1096c74c4..b9a05ed00f 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -293,7 +293,8 @@ public class MapActivityActions implements DialogProvider {
 					dlg.findViewById(R.id.DuplicateFileName).setVisibility(View.VISIBLE);
 				} else {
 					dlg.dismiss();
-					new SaveDirectionsAsyncTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
+					new SaveDirectionsAsyncTask(app, false)
+							.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
 				}
 			}
 		});
@@ -309,31 +310,41 @@ public class MapActivityActions implements DialogProvider {
 		return dlg;
 	}
 
-	private static class SaveDirectionsAsyncTask extends AsyncTask {
+	public static class SaveDirectionsAsyncTask extends AsyncTask {
 
 		private final OsmandApplication app;
+		boolean showOnMap;
 
-		public SaveDirectionsAsyncTask(OsmandApplication app) {
+		public SaveDirectionsAsyncTask(OsmandApplication app, boolean showOnMap) {
 			this.app = app;
+			this.showOnMap = showOnMap;
 		}
 
 		@Override
-		protected String doInBackground(File... params) {
+		protected GPXFile doInBackground(File... params) {
 			if (params.length > 0) {
 				File file = params[0];
 				String fileName = file.getName();
-				GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0,fileName.length()-GPX_FILE_EXT.length()));
-				GPXUtilities.writeGpxFile(file, gpx);
-				return app.getString(R.string.route_successfully_saved_at, file.getName());
+				GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0, fileName.length() - GPX_FILE_EXT.length()));
+				gpx.error = GPXUtilities.writeGpxFile(file, gpx);
+				return gpx;
 			}
 			return null;
 		}
 
 		@Override
-		protected void onPostExecute(String result) {
-			if (result != null) {
-				Toast.makeText(app, result, Toast.LENGTH_LONG).show();
+		protected void onPostExecute(GPXFile gpxFile) {
+			if (gpxFile.error != null) {
+				String errorMessage = gpxFile.error.getMessage();
+				if (errorMessage == null) {
+					errorMessage = app.getString(R.string.error_occurred_saving_gpx);
+				}
+				Toast.makeText(app, errorMessage, Toast.LENGTH_LONG).show();
+				return;
 			}
+			app.getSelectedGpxHelper().selectGpxFile(gpxFile, showOnMap, false);
+			String result = app.getString(R.string.route_successfully_saved_at, gpxFile.tracks.get(0).name);
+			Toast.makeText(app, result, Toast.LENGTH_LONG).show();
 		}
 
 	}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index 8007470ba6..3ca09c6154 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -34,6 +34,7 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.google.android.material.snackbar.Snackbar;
 
 import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
 import net.osmand.GPXUtilities;
 import net.osmand.GPXUtilities.GPXFile;
 import net.osmand.GPXUtilities.Track;
@@ -85,11 +86,8 @@ import net.osmand.util.Algorithms;
 import java.io.File;
 import java.lang.ref.WeakReference;
 import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
-import java.util.Locale;
 
 import static net.osmand.IndexConstants.GPX_FILE_EXT;
 import static net.osmand.IndexConstants.GPX_INDEX_DIR;
@@ -1487,18 +1485,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
 		GpxData gpxData = editingCtx.getGpxData();
 		String displayedName;
 		if (gpxData == null) {
-			final String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
-			displayedName = suggestedName;
-			OsmandApplication app = getMyApplication();
-			if (app != null) {
-				File dir = app.getAppPath(GPX_INDEX_DIR);
-				File fout = new File(dir, suggestedName + GPX_FILE_EXT);
-				int ind = 0;
-				while (fout.exists()) {
-					displayedName = suggestedName + "_" + (++ind);
-					fout = new File(dir, displayedName + GPX_FILE_EXT);
-				}
-			}
+			displayedName = FileUtils.createName(getMyApplication());
 		} else {
 			displayedName = AndroidUtils.trimExtension(new File(gpxData.getGpxFile().path).getName());
 		}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
index 0355bba809..fb1badf2aa 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
@@ -8,6 +8,7 @@ import android.os.Bundle;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.View;
+import android.widget.EditText;
 import android.widget.Toast;
 
 import androidx.annotation.NonNull;
@@ -59,6 +60,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 	private String folderName;
 	private boolean rightButtonEnabled = true;
 	private boolean showSimplifiedButton = true;
+	private TextInputLayout nameTextBox;
 
 	@Override
 	public void createMenuItems(Bundle savedInstanceState) {
@@ -80,7 +82,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 
 		View editNameView = View.inflate(UiUtilities.getThemedContext(app, nightMode),
 				R.layout.track_name_edit_text, null);
-		final TextInputLayout nameTextBox = editNameView.findViewById(R.id.name_text_box);
+		nameTextBox = editNameView.findViewById(R.id.name_text_box);
 		nameTextBox.setBoxBackgroundColorResource(R.color.material_text_input_layout_bg);
 		nameTextBox.setHint(app.getString(R.string.ltr_or_rtl_combine_via_colon,
 				app.getString(R.string.shared_string_file_name), "").trim());
@@ -100,7 +102,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 
 			@Override
 			public void afterTextChanged(Editable s) {
-				checkEmptyName(s, nameTextBox);
+				checkEmptyName(s.toString());
 			}
 		});
 		BaseBottomSheetItem editFileName = new BaseBottomSheetItem.Builder()
@@ -206,6 +208,10 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 			@Override
 			public void onItemSelected(String item) {
 				folderName = item;
+				EditText editText = nameTextBox.getEditText();
+				if (editText != null) {
+					checkEmptyName(editText.getText().toString());
+				}
 			}
 		};
 	}
@@ -260,17 +266,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 	private void renameFile() {
 		OsmandApplication app = getMyApplication();
 		if (app != null) {
-			File dir = getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
-			File source = dir;
-			if (sourceFolderName != null) {
-				source = new File(dir, sourceFolderName);
-			}
-			source = new File(source, sourceFileName + IndexConstants.GPX_FILE_EXT);
-			File dest = dir;
-			if (folderName != null) {
-				dest = new File(dir, folderName);
-			}
-			dest = new File(dest, fileName + IndexConstants.GPX_FILE_EXT);
+			File source = getFile(app, sourceFolderName, sourceFileName);
+			File dest = getFile(app, folderName, fileName);
 			if (!source.equals(dest)) {
 				if (dest.exists()) {
 					Toast.makeText(app, R.string.file_with_name_already_exists, Toast.LENGTH_LONG).show();
@@ -290,25 +287,46 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
 		}
 	}
 
+	private File getFile(OsmandApplication app, String folderName, String fileName) {
+		File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+		File source = dir;
+		if (folderName != null) {
+			source = new File(dir, folderName);
+		}
+		source = new File(source, fileName + IndexConstants.GPX_FILE_EXT);
+		return source;
+	}
+
 	@Override
 	protected boolean isRightBottomButtonEnabled() {
 		return rightButtonEnabled;
 	}
 
-	private void checkEmptyName(Editable name, TextInputLayout nameCaption) {
-		String text = name.toString().trim();
+	private void checkEmptyName(String name) {
+		rightButtonEnabled = false;
+		String text = name.trim();
 		if (text.isEmpty()) {
-			nameCaption.setError(getString(R.string.empty_filename));
-			rightButtonEnabled = false;
+			nameTextBox.setError(getString(R.string.empty_filename));
+		} else if (isFileExist(name)) {
+			nameTextBox.setError(getString(R.string.file_with_name_already_exist));
 		} else {
-			nameCaption.setError(null);
+			nameTextBox.setError(null);
 			fileName = text;
 			rightButtonEnabled = true;
 		}
 		updateBottomButtons();
 	}
 
-	interface SaveAsNewTrackFragmentListener {
+	private boolean isFileExist(String name) {
+		OsmandApplication app = getMyApplication();
+		if (app != null) {
+			File file = getFile(app, folderName, name);
+			return file.exists();
+		}
+		return false;
+	}
+
+	public interface SaveAsNewTrackFragmentListener {
 
 		void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack);
 
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
index c94c6e2968..b3e773c881 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
@@ -6,6 +6,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
 import android.text.Html;
@@ -33,7 +34,9 @@ import androidx.fragment.app.FragmentPagerAdapter;
 import androidx.viewpager.widget.ViewPager;
 
 import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
 import net.osmand.GPXUtilities;
+import net.osmand.IndexConstants;
 import net.osmand.data.LatLon;
 import net.osmand.data.PointDescription;
 import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
@@ -42,17 +45,18 @@ import net.osmand.plus.OsmAndFormatter;
 import net.osmand.plus.OsmandApplication;
 import net.osmand.plus.R;
 import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.MapActivityActions;
 import net.osmand.plus.activities.PrintDialogActivity;
 import net.osmand.plus.base.BaseOsmAndFragment;
 import net.osmand.plus.base.ContextMenuFragment;
 import net.osmand.plus.base.ContextMenuFragment.ContextMenuFragmentListener;
 import net.osmand.plus.base.ContextMenuFragment.MenuState;
 import net.osmand.plus.helpers.AndroidUiHelper;
+import net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment;
 import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.CumulativeInfo;
 import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.RouteDetailsFragmentListener;
 import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
 import net.osmand.plus.routing.RouteDirectionInfo;
+import net.osmand.plus.routing.RouteProvider;
 import net.osmand.plus.routing.RoutingHelper;
 import net.osmand.plus.routing.TransportRoutingHelper;
 import net.osmand.plus.settings.backend.OsmandSettings;
@@ -73,12 +77,15 @@ import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 
+import static net.osmand.IndexConstants.GPX_FILE_EXT;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
+import static net.osmand.plus.activities.MapActivityActions.*;
+import static net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment.*;
 
 public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMenuFragmentListener,
-		RouteDetailsFragmentListener {
+		RouteDetailsFragmentListener, SaveAsNewTrackFragmentListener {
 
 	public static final String TAG = "ChooseRouteFragment";
 	public static final String ROUTE_INDEX_KEY = "route_index_key";
@@ -460,9 +467,19 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
 			@Override
 			public void onClick(View v) {
 				MapActivity mapActivity = getMapActivity();
-				if (mapActivity != null) {
-					RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
-					MapActivityActions.createSaveDirections(mapActivity, routingHelper).show();
+				OsmandApplication app = getMyApplication();
+				if (mapActivity != null && app != null) {
+					RoutingHelper routingHelper = app.getRoutingHelper();
+					final RouteProvider.GPXRouteParamsBuilder rp = routingHelper.getCurrentGPXRoute();
+					final String fileName;
+					if (rp == null || rp.getFile() == null || rp.getFile().path == null) {
+						fileName = FileUtils.createName(app);
+					} else {
+						fileName = new File(rp.getFile().path).getName();
+					}
+					SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(),
+							ChooseRouteFragment.this, null, fileName,
+							false, true);
 				}
 			}
 		};
@@ -861,6 +878,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
 		}
 	}
 
+	@Override
+	public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) {
+		OsmandApplication app = getMyApplication();
+		if (app != null) {
+			File fileDir = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName == null ? "" : folderName);
+			File toSave = new File(fileDir, fileName + GPX_FILE_EXT);
+			new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
+		}
+	}
+
 	public class RoutesPagerAdapter extends FragmentPagerAdapter {
 		private int routesCount;
 

From e955652a6b31129792e90f548b718d4f693f739b Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Mon, 14 Sep 2020 15:02:14 +0300
Subject: [PATCH 03/29] Clean up MapActivity from back fragments

---
 .../osmand/plus/activities/MapActivity.java   | 80 +------------------
 .../plus/mapmarkers/PlanRouteFragment.java    | 16 +++-
 .../GpxApproximationFragment.java             | 11 +++
 .../MeasurementToolFragment.java              | 11 +++
 .../SnapTrackWarningFragment.java             | 17 +++-
 .../ChooseRouteFragment.java                  | 11 +++
 .../fragments/ConfigureMenuItemsFragment.java | 22 +++--
 .../fragments/ImportCompleteFragment.java     |  7 ++
 .../fragments/ImportSettingsFragment.java     |  7 ++
 .../fragments/ProfileAppearanceFragment.java  | 11 ++-
 10 files changed, 102 insertions(+), 91 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index efe26164d2..cb83865ced 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -116,7 +116,6 @@ import net.osmand.plus.mapcontextmenu.editors.PointEditorFragmentNew;
 import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
 import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
 import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
-import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
 import net.osmand.plus.mapmarkers.PlanRouteFragment;
 import net.osmand.plus.measurementtool.GpxApproximationFragment;
 import net.osmand.plus.measurementtool.GpxData;
@@ -141,12 +140,8 @@ import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomiz
 import net.osmand.plus.settings.backend.OsmandSettings;
 import net.osmand.plus.settings.fragments.BaseSettingsFragment;
 import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
-import net.osmand.plus.settings.fragments.ConfigureMenuItemsFragment;
 import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
 import net.osmand.plus.settings.fragments.DataStorageFragment;
-import net.osmand.plus.settings.fragments.ImportCompleteFragment;
-import net.osmand.plus.settings.fragments.ImportSettingsFragment;
-import net.osmand.plus.settings.fragments.ProfileAppearanceFragment;
 import net.osmand.plus.track.TrackAppearanceFragment;
 import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
 import net.osmand.plus.views.AnimateDraggingMapThread;
@@ -684,42 +679,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 				return;
 			}
 		}
-		PlanRouteFragment planRouteFragment = getPlanRouteFragment();
-		if (planRouteFragment != null) {
-			if (planRouteFragment.quit(true)) {
-				MapMarkersDialogFragment.showInstance(this);
-			}
-			return;
-		}
-
-		SnapTrackWarningFragment snapTrackWarningFragment = getSnapTrackWarningBottomSheet();
-		if (snapTrackWarningFragment != null) {
-			snapTrackWarningFragment.dismissImmediate();
-			return;
-		}
-
-		GpxApproximationFragment gpxApproximationFragment = getGpxApproximationFragment();
-		if (gpxApproximationFragment != null) {
-			gpxApproximationFragment.dismissImmediate();
-			return;
-		}
-
-		MeasurementToolFragment measurementToolFragment = getMeasurementToolFragment();
-		if (measurementToolFragment != null) {
-			measurementToolFragment.quit(true);
-			return;
-		}
-		ChooseRouteFragment chooseRouteFragment = getChooseRouteFragment();
-		if (chooseRouteFragment != null) {
-			chooseRouteFragment.dismiss(true);
-			return;
-		}
-		ProfileAppearanceFragment profileAppearanceFragment = getProfileAppearanceFragment();
-		if (profileAppearanceFragment != null) {
-			if (profileAppearanceFragment.isProfileAppearanceChanged()) {
-				return;
-			}
-		}
 
 		PointEditorFragmentNew pointEditorFragmentNew = getPointEditorFragmentNew();
 		if (pointEditorFragmentNew != null) {
@@ -769,26 +728,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		} else if (getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
 			return;
 		}
-		ImportSettingsFragment importSettingsFragment = getImportSettingsFragment();
-		if (importSettingsFragment != null) {
-			importSettingsFragment.showExitDialog();
-			return;
-		}
-		ImportCompleteFragment importCompleteFragment = getImportCompleteFragment();
-		if (importCompleteFragment != null) {
-			importCompleteFragment.dismissFragment();
-			return;
-		}
-		ConfigureMenuItemsFragment configureMenuItemsFragment = getConfigureMenuItemsFragment();
-		if (configureMenuItemsFragment != null) {
-			configureMenuItemsFragment.exitFragment();
-			return;
-		}
-
 		super.onBackPressed();
 	}
 
-
 	private void quitAddGpxPointMode() {
 		getMapLayers().getContextMenuLayer().getAddGpxPointBottomSheetHelper().hide();
 		getMapLayers().getContextMenuLayer().quitAddGpxPoint();
@@ -930,7 +872,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 						DataStoragePlaceDialogFragment.showInstance(getSupportFragmentManager(), true);
 					} else {
 						ActivityCompat.requestPermissions(this,
-								new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
+								new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
 								DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
 					}
 				}
@@ -2301,24 +2243,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		return getFragment(ChooseRouteFragment.TAG);
 	}
 
-	public ProfileAppearanceFragment getProfileAppearanceFragment() {
-		return getFragment(ProfileAppearanceFragment.TAG);
-	}
-
 	public QuickActionListFragment getQuickActionListFragment() {
-		return  getFragment(QuickActionListFragment.TAG);
-	}
-
-	public ImportSettingsFragment getImportSettingsFragment() {
-		return getFragment(ImportSettingsFragment.TAG);
-	}
-
-	public ImportCompleteFragment getImportCompleteFragment() {
-		return getFragment(ImportCompleteFragment.TAG);
-	}
-
-	public ConfigureMenuItemsFragment getConfigureMenuItemsFragment() {
-		return getFragment(ConfigureMenuItemsFragment.TAG);
+		return getFragment(QuickActionListFragment.TAG);
 	}
 
 	public TrackAppearanceFragment getTrackAppearanceFragment() {
@@ -2353,7 +2279,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		}
 	}
 
-	 T getFragment(String fragmentTag){
+	 T getFragment(String fragmentTag) {
 		Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
 		return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;
 	}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
index 89a1016ea0..60399c3872 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
@@ -17,6 +17,7 @@ import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -57,8 +58,8 @@ import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapT
 import net.osmand.plus.routing.RoutingHelper;
 import net.osmand.plus.settings.backend.ApplicationMode;
 import net.osmand.plus.settings.backend.OsmandSettings;
-import net.osmand.plus.views.layers.MapMarkersLayer;
 import net.osmand.plus.views.OsmandMapTileView;
+import net.osmand.plus.views.layers.MapMarkersLayer;
 import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
 import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
 import net.osmand.util.MapUtils;
@@ -96,6 +97,19 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
 	private View mainView;
 	private RecyclerView markersRv;
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				MapActivity mapActivity = getMapActivity();
+				if (mapActivity != null && quit(true)) {
+					MapMarkersDialogFragment.showInstance(mapActivity);
+				}
+			}
+		});
+	}
+
 	@Nullable
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
index 68029eb36a..393e43b31b 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
@@ -9,6 +9,7 @@ import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
@@ -97,6 +98,16 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
 		return MenuState.HALF_SCREEN;
 	}
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				dismissImmediate();
+			}
+		});
+	}
+
 	@Nullable
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index c176275725..e51890c75e 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -20,6 +20,7 @@ import android.widget.ProgressBar;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -170,6 +171,16 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
 		this.directionMode = directionMode;
 	}
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				quit(true);
+			}
+		});
+	}
+
 	@Nullable
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
index 6730e4d923..49e1fa3d65 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
@@ -9,7 +9,9 @@ import android.view.ViewGroup;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
@@ -30,11 +32,12 @@ import net.osmand.plus.views.layers.MapInfoLayer;
 import org.apache.commons.logging.Log;
 
 import static android.view.Gravity.TOP;
-import static android.view.ViewGroup.LayoutParams.*;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
-import static net.osmand.plus.UiUtilities.DialogButtonType.*;
+import static net.osmand.plus.UiUtilities.DialogButtonType.PRIMARY;
+import static net.osmand.plus.UiUtilities.DialogButtonType.SECONDARY;
 
 public class SnapTrackWarningFragment extends BaseOsmAndFragment {
 
@@ -56,6 +59,16 @@ public class SnapTrackWarningFragment extends BaseOsmAndFragment {
 	private boolean nightMode;
 	private boolean portrait;
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				dismissImmediate();
+			}
+		});
+	}
+
 	public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		OsmandApplication app = getMyApplication();
 		if (app != null) {
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
index c94c6e2968..6143db9fb2 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
@@ -21,6 +21,7 @@ import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -111,6 +112,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
 	private boolean publicTransportMode;
 	private boolean needAdjustMap;
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				dismiss(true);
+			}
+		});
+	}
+
 	@Nullable
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
index d9980e0640..44fb4bf7f6 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
@@ -1,6 +1,5 @@
 package net.osmand.plus.settings.fragments;
 
-import android.app.Activity;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.os.Build;
@@ -11,6 +10,7 @@ import android.view.ViewGroup;
 import android.widget.ImageButton;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
@@ -24,11 +24,9 @@ import com.google.android.material.appbar.AppBarLayout;
 
 import net.osmand.AndroidUtils;
 import net.osmand.PlatformUtil;
-import net.osmand.plus.settings.backend.ApplicationMode;
 import net.osmand.plus.ContextMenuAdapter;
 import net.osmand.plus.ContextMenuItem;
 import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.settings.backend.OsmandSettings;
 import net.osmand.plus.R;
 import net.osmand.plus.UiUtilities;
 import net.osmand.plus.activities.MapActivity;
@@ -36,11 +34,13 @@ import net.osmand.plus.base.BaseOsmAndFragment;
 import net.osmand.plus.dialogs.ConfigureMapMenu;
 import net.osmand.plus.mapcontextmenu.MapContextMenu;
 import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet;
-import net.osmand.plus.settings.fragments.ConfigureMenuRootFragment.ScreenType;
+import net.osmand.plus.settings.backend.ApplicationMode;
+import net.osmand.plus.settings.backend.OsmandSettings;
 import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
-import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
-import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
+import net.osmand.plus.settings.fragments.ConfigureMenuRootFragment.ScreenType;
 import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.MenuItemsAdapterListener;
+import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
+import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
 
 import org.apache.commons.logging.Log;
 
@@ -83,7 +83,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
 	private boolean nightMode;
 	private boolean wasReset = false;
 	private boolean isChanged = false;
-	private Activity activity;
+	private FragmentActivity activity;
 	private RecyclerView recyclerView;
 
 	@Override
@@ -149,7 +149,13 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
 		nightMode = !app.getSettings().isLightContentForMode(appMode);
 		mInflater = UiUtilities.getInflater(app, nightMode);
 		mainActionItems = new ArrayList<>();
-		activity = getActivity();
+		activity = requireActivity();
+		activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			@Override
+			public void handleOnBackPressed() {
+				exitFragment();
+			}
+		});
 	}
 
 	private void initSavedIds(ApplicationMode appMode) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
index a521e8e079..a18e2f6aa9 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
@@ -12,6 +12,7 @@ import android.view.ViewTreeObserver;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.FragmentManager;
@@ -62,6 +63,12 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
 		super.onCreate(savedInstanceState);
 		app = requireMyApplication();
 		nightMode = !app.getSettings().isLightContent();
+		requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			@Override
+			public void handleOnBackPressed() {
+				dismissFragment();
+			}
+		});
 	}
 
 	@Nullable
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
index 13dc2f94ce..284964b88d 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
@@ -16,6 +16,7 @@ import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
@@ -106,6 +107,12 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
 		app = requireMyApplication();
 		settingsHelper = app.getSettingsHelper();
 		nightMode = !app.getSettings().isLightContent();
+		requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			@Override
+			public void handleOnBackPressed() {
+				showExitDialog();
+			}
+		});
 	}
 
 	@Nullable
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
index 9ea296e925..6fcf8a17bf 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
@@ -23,6 +23,7 @@ import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
@@ -151,6 +152,11 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
 			changedProfile.navigationIcon = profile.navigationIcon;
 			isNewProfile = ApplicationMode.valueOfStringKey(changedProfile.stringKey, null) == null;
 		}
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				showExitDialog();
+			}
+		});
 	}
 
 	public void setupAppProfileObjectFromAppMode(ApplicationMode baseModeForNewProfile) {
@@ -893,7 +899,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
 		profileNameOtfb.setError(errorMessage, true);
 	}
 
-	public boolean isProfileAppearanceChanged() {
+	public void showExitDialog() {
 		hideKeyboard();
 		if (isChanged()) {
 			AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(),
@@ -906,9 +912,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
 				}
 			});
 			dismissDialog.show();
-			return true;
 		} else {
-			return false;
+			dismiss();
 		}
 	}
 

From c2e110604d233b552bd48bf911a90d1f76a4102e Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Mon, 14 Sep 2020 21:46:11 +0300
Subject: [PATCH 04/29] Clean up onBackPressed in MapActivity from fragments

---
 .../osmand/plus/activities/MapActivity.java   | 82 +++----------------
 .../plus/activities/MapActivityActions.java   |  1 +
 .../MapContextMenuFragment.java               | 36 ++++----
 .../editors/PointEditorFragmentNew.java       | 37 ++++++++-
 .../other/TrackDetailsMenuFragment.java       | 25 +++++-
 .../quickaction/QuickActionListFragment.java  | 24 +++++-
 .../plus/track/TrackAppearanceFragment.java   | 10 +++
 7 files changed, 123 insertions(+), 92 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index cb83865ced..45b4e8c105 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -86,7 +86,6 @@ import net.osmand.plus.base.FailSafeFuntions;
 import net.osmand.plus.base.MapViewTrackingUtilities;
 import net.osmand.plus.chooseplan.OsmLiveCancelledDialog;
 import net.osmand.plus.dashboard.DashboardOnMap;
-import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
 import net.osmand.plus.dialogs.CrashBottomSheetDialogFragment;
 import net.osmand.plus.dialogs.ImportGpxBottomSheetDialogFragment;
 import net.osmand.plus.dialogs.RateUsBottomSheetDialogFragment;
@@ -109,11 +108,7 @@ import net.osmand.plus.helpers.ScrollHelper.OnScrollEventListener;
 import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
 import net.osmand.plus.mapcontextmenu.MapContextMenu;
 import net.osmand.plus.mapcontextmenu.MenuController;
-import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
 import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
-import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
-import net.osmand.plus.mapcontextmenu.editors.PointEditorFragmentNew;
-import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
 import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
 import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
 import net.osmand.plus.mapmarkers.PlanRouteFragment;
@@ -122,7 +117,6 @@ import net.osmand.plus.measurementtool.GpxData;
 import net.osmand.plus.measurementtool.MeasurementEditingContext;
 import net.osmand.plus.measurementtool.MeasurementToolFragment;
 import net.osmand.plus.measurementtool.SnapTrackWarningFragment;
-import net.osmand.plus.quickaction.QuickActionListFragment;
 import net.osmand.plus.render.RendererRegistry;
 import net.osmand.plus.resources.ResourceManager;
 import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
@@ -153,7 +147,6 @@ import net.osmand.plus.views.OsmandMapTileView.OnDrawMapListener;
 import net.osmand.plus.views.corenative.NativeCoreContext;
 import net.osmand.plus.views.layers.MapControlsLayer;
 import net.osmand.plus.views.layers.MapInfoLayer;
-import net.osmand.plus.views.layers.MapQuickActionLayer;
 import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
 import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
 import net.osmand.render.RenderingRulesStorage;
@@ -668,44 +661,16 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 			showQuickSearch(ShowQuickSearchMode.CURRENT, false);
 			return;
 		}
-		if (trackDetailsMenu.isVisible()) {
-			trackDetailsMenu.hide(true);
-			if (mapContextMenu.isActive() && mapContextMenu.getPointDescription() != null
-					&& mapContextMenu.getPointDescription().isGpxPoint()) {
-				mapContextMenu.show();
-				return;
-			}
-			if (prevActivityIntent == null) {
-				return;
-			}
-		}
-
-		PointEditorFragmentNew pointEditorFragmentNew = getPointEditorFragmentNew();
-		if (pointEditorFragmentNew != null) {
-			pointEditorFragmentNew.showExitDialog();
-			return;
-		}
-
-		TrackAppearanceFragment trackAppearanceFragment = getTrackAppearanceFragment();
-		if (trackAppearanceFragment != null) {
-			trackAppearanceFragment.dismissImmediate();
-			if (prevActivityIntent == null) {
-				return;
-			}
-		}
-
-
-		if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
-			if (mapContextMenu.getCurrentMenuState() != MenuState.HEADER_ONLY && !isLandscapeLayout()) {
-				mapContextMenu.openMenuHeaderOnly();
-			} else {
-				mapContextMenu.close();
-			}
-			return;
-		}
 		if (getMapLayers().getContextMenuLayer().isInAddGpxPointMode()) {
 			quitAddGpxPointMode();
 		}
+		if (launchPrevActivityIntent()) {
+			return;
+		}
+		super.onBackPressed();
+	}
+
+	public boolean launchPrevActivityIntent() {
 		if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
 			prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
 			LatLon loc = getMapLocation();
@@ -714,21 +679,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 			if (mapViewTrackingUtilities.isMapLinkedToLocation()) {
 				prevActivityIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
 			}
-			this.startActivity(prevActivityIntent);
+			startActivity(prevActivityIntent);
 			prevActivityIntent = null;
-			return;
+			return true;
 		}
-		QuickActionListFragment quickActionListFragment = getQuickActionListFragment();
-		if (quickActionListFragment != null && quickActionListFragment.isVisible()) {
-			if (quickActionListFragment.fromDashboard()) {
-				this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
-			} else {
-				getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed();
-			}
-		} else if (getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
-			return;
-		}
-		super.onBackPressed();
+		return false;
 	}
 
 	private void quitAddGpxPointMode() {
@@ -2243,14 +2198,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		return getFragment(ChooseRouteFragment.TAG);
 	}
 
-	public QuickActionListFragment getQuickActionListFragment() {
-		return getFragment(QuickActionListFragment.TAG);
-	}
-
-	public TrackAppearanceFragment getTrackAppearanceFragment() {
-		return getFragment(TrackAppearanceFragment.TAG);
-	}
-
 	public GpxApproximationFragment getGpxApproximationFragment() {
 		return getFragment(GpxApproximationFragment.TAG);
 	}
@@ -2259,15 +2206,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		return getFragment(SnapTrackWarningFragment.TAG);
 	}
 
-	public PointEditorFragmentNew getPointEditorFragmentNew() {
-		PointEditorFragmentNew pointEditorFragmentNew;
-		pointEditorFragmentNew = getFragment(FavoritePointEditor.TAG);
-		if (pointEditorFragmentNew == null) {
-			pointEditorFragmentNew = getFragment(WptPtEditor.TAG);
-		}
-		return pointEditorFragmentNew;
-	}
-
 	public void backToConfigureProfileFragment() {
 		FragmentManager fragmentManager = getSupportFragmentManager();
 		int backStackEntryCount = fragmentManager.getBackStackEntryCount();
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index ab05b2e2f3..bdc1e5d737 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -476,6 +476,7 @@ public class MapActivityActions implements DialogProvider {
 				} else if (standardId == R.string.avoid_road) {
 					getMyApplication().getAvoidSpecificRoads().addImpassableRoad(mapActivity, new LatLon(latitude, longitude), true, false, null);
 				} else if (standardId == R.string.shared_string_add || standardId == R.string.favourites_context_menu_edit) {
+					mapActivity.getContextMenu().hide();
 					mapActivity.getContextMenu().buttonFavoritePressed();
 				} else if (standardId == R.string.shared_string_marker || standardId == R.string.shared_string_edit) {
 					mapActivity.getContextMenu().buttonWaypointPressed();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 44748e36bb..7a53629f4d 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -37,6 +37,7 @@ import android.widget.OverScroller;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.content.res.AppCompatResources;
@@ -108,11 +109,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 	private InterceptorLinearLayout mainView;
 
 	private View toolbarContainer;
-	private View toolbarView;
-	private ImageView toolbarBackButton;
 	private TextView toolbarTextView;
 	private View topButtonContainer;
-	private LockableScrollView menuScrollView;
 
 	private LinearLayout mainRouteBadgeContainer;
 	private LinearLayout nearbyRoutesLayout;
@@ -123,8 +121,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 	private TextView localRoutesMoreTv;
 
 	private View zoomButtonsView;
-	private ImageButton zoomInButtonView;
-	private ImageButton zoomOutButtonView;
 
 	private MapContextMenu menu;
 	private OnLayoutChangeListener containerLayoutListener;
@@ -149,7 +145,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 	private int topScreenPosY;
 	private int bottomToolbarPosY;
 	private int minHalfY;
-	private int shadowHeight;
 	private int zoomPaddingTop;
 
 	private OsmandMapTileView map;
@@ -164,13 +159,28 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 	private boolean wasDrawerDisabled;
 	private boolean zoomIn;
 
-	private int screenOrientation;
 	private boolean created;
 
 	private boolean transportBadgesCreated;
 
 	private UpdateLocationViewCache updateLocationViewCache;
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				if (menu.isVisible() && menu.isClosable()) {
+					if (menu.getCurrentMenuState() != MenuState.HEADER_ONLY && !menu.isLandscapeLayout()) {
+						menu.openMenuHeaderOnly();
+					} else {
+						menu.close();
+					}
+				}
+			}
+		});
+	}
+
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
 	                         Bundle savedInstanceState) {
@@ -188,7 +198,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 
 		markerPaddingPx = dpToPx(MARKER_PADDING_DP);
 		markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
-		shadowHeight = dpToPx(SHADOW_HEIGHT_TOP_DP);
+		int shadowHeight = dpToPx(SHADOW_HEIGHT_TOP_DP);
 		topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight);
 		bottomToolbarPosY = addStatusBarHeightIfNeeded(getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar));
 		minHalfY = viewHeight - (int) (viewHeight * menu.getHalfScreenMaxHeightKoef());
@@ -204,8 +214,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 		mainView = view.findViewById(R.id.context_menu_main);
 
 		toolbarContainer = view.findViewById(R.id.context_menu_toolbar_container);
-		toolbarView = view.findViewById(R.id.context_menu_toolbar);
-		toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back);
+		ImageView toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back);
 		toolbarTextView = (TextView) view.findViewById(R.id.context_menu_toolbar_text);
 		updateVisibility(toolbarContainer, 0);
 		toolbarBackButton.setOnClickListener(new View.OnClickListener() {
@@ -510,9 +519,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 
 		// Zoom buttons
 		zoomButtonsView = view.findViewById(R.id.context_menu_zoom_buttons);
-		zoomInButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_in_button);
-		zoomOutButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_out_button);
 		if (menu.zoomButtonsVisible()) {
+			ImageButton zoomInButtonView = view.findViewById(R.id.context_menu_zoom_in_button);
+			ImageButton zoomOutButtonView = view.findViewById(R.id.context_menu_zoom_out_button);
 			AndroidUtils.updateImageButton(app, zoomInButtonView, R.drawable.ic_zoom_in, R.drawable.ic_zoom_in,
 					R.drawable.btn_circle_trans, R.drawable.btn_circle_night, nightMode);
 			AndroidUtils.updateImageButton(app, zoomOutButtonView, R.drawable.ic_zoom_out, R.drawable.ic_zoom_out,
@@ -2302,5 +2311,4 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 		updateAdditionalInfoVisibility();
 		runLayoutListener();
 	}
-}
-
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index ae5bb9355b..cd7a783a7b 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -25,6 +25,7 @@ import android.widget.ImageView;
 import android.widget.ScrollView;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.ColorInt;
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
@@ -49,6 +50,7 @@ import net.osmand.plus.activities.MapActivity;
 import net.osmand.plus.base.BaseOsmAndFragment;
 import net.osmand.plus.helpers.AndroidUiHelper;
 import net.osmand.plus.helpers.ColorDialogs;
+import net.osmand.plus.mapcontextmenu.MapContextMenu;
 import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
 import net.osmand.plus.widgets.FlowLayout;
 import net.osmand.util.Algorithms;
@@ -99,6 +101,19 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
 	private EditText addressEdit;
 	private int layoutHeightPrevious = 0;
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				MapActivity mapActivity = getMapActivity();
+				if (mapActivity != null) {
+					showExitDialog();
+				}
+			}
+		});
+	}
+
 	@SuppressLint("ClickableViewAccessibility")
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
@@ -867,14 +882,28 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
 			dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() {
 				@Override
 				public void onClick(DialogInterface dialog, int which) {
-					cancelled = true;
-					dismiss();
+					exitEditing();
 				}
 			});
 			dismissDialog.show();
 		} else {
-			cancelled = true;
-			dismiss();
+			exitEditing();
+		}
+	}
+
+	private void exitEditing() {
+		cancelled = true;
+		dismiss();
+		showContextMenu();
+	}
+
+	private void showContextMenu() {
+		MapActivity mapActivity = getMapActivity();
+		if (mapActivity != null) {
+			MapContextMenu mapContextMenu = mapActivity.getContextMenu();
+			if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
+				mapContextMenu.show();
+			}
 		}
 	}
 
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
index f456ba0360..2a06fe71a7 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
@@ -12,6 +12,7 @@ import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.FragmentActivity;
@@ -49,11 +50,33 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment implements OsmA
 		return (MapActivity) requireMyActivity();
 	}
 
+	@Override
+	public void onCreate(@Nullable Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		final MapActivity mapActivity = requireMapActivity();
+		menu = mapActivity.getTrackDetailsMenu();
+
+		mapActivity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				if (menu.isVisible()) {
+					menu.hide(true);
+
+					MapContextMenu contextMenu = mapActivity.getContextMenu();
+					if (contextMenu.isActive() && contextMenu.getPointDescription() != null
+							&& contextMenu.getPointDescription().isGpxPoint()) {
+						contextMenu.show();
+					} else {
+						mapActivity.launchPrevActivityIntent();
+					}
+				}
+			}
+		});
+	}
+
 	@Override
 	public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
 							 Bundle savedInstanceState) {
 		MapActivity mapActivity = requireMapActivity();
-		menu = mapActivity.getTrackDetailsMenu();
 		nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
 		View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.track_details, container, false);
 		if (!AndroidUiHelper.isOrientationPortrait(mapActivity)) {
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
index 036b60230f..ef7f8970b1 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
@@ -18,6 +18,7 @@ import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.SwitchCompat;
@@ -38,11 +39,12 @@ import net.osmand.plus.R;
 import net.osmand.plus.UiUtilities;
 import net.osmand.plus.activities.MapActivity;
 import net.osmand.plus.base.BaseOsmAndFragment;
+import net.osmand.plus.dashboard.DashboardOnMap;
 import net.osmand.plus.settings.backend.ApplicationMode;
-import net.osmand.plus.views.layers.MapQuickActionLayer;
 import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
 import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.OnItemMoveCallback;
 import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.UnmovableItem;
+import net.osmand.plus.views.layers.MapQuickActionLayer;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -100,6 +102,26 @@ public class QuickActionListFragment extends BaseOsmAndFragment
             }
             screenType = savedInstanceState.getInt(SCREEN_TYPE_KEY, SCREEN_TYPE_REORDER);
         }
+        requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+            public void handleOnBackPressed() {
+                MapActivity mapActivity = getMapActivity();
+                if (mapActivity != null) {
+                    if (isVisible()) {
+                        if (fromDashboard()) {
+                            mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.CONFIGURE_SCREEN, null);
+                        } else {
+                            mapActivity.getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed();
+                        }
+                    } else if (mapActivity.getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
+                        return;
+                    }
+                    FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
+                    if (!fragmentManager.isStateSaved()) {
+                        fragmentManager.popBackStackImmediate();
+                    }
+                }
+            }
+        });
     }
 
     @Nullable
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
index c0fe05d060..5061323bc5 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
@@ -14,6 +14,7 @@ import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.ColorInt;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -147,6 +148,15 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
 			}
 			updateTrackColor();
 		}
+		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				MapActivity mapActivity = getMapActivity();
+				if (mapActivity != null) {
+					dismissImmediate();
+					mapActivity.launchPrevActivityIntent();
+				}
+			}
+		});
 	}
 
 	private void updateTrackColor() {

From 14b94b7051dbc5bbd2207528d8426ec473abcc88 Mon Sep 17 00:00:00 2001
From: Hardy 
Date: Mon, 14 Sep 2020 21:26:11 +0200
Subject: [PATCH 05/29] some string improvements

---
 OsmAnd/res/values/strings.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 7f95db8cd1..5df1c73d6e 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,10 +12,10 @@
 
 -->
     
-    • Updated "Plan Route" mode allows using different navigation types for each segment and attaches any track to the roads\n\n
-    • New "Appearance" options for tracks: select color, thickness turn on the direction arrows and start/finish marks\n\n
-    • Improved bicycle nodes visibility\n\n
-    • Context menu for tracks with basic info\n\n
+    • Updated "Plan a route" function: allows using different navigation types per segment and the inclusion of tracks\n\n
+    • New "Appearance" menu for tracks: select color, thickness, and direction arrows. Tracks now indicate start/finish icons.\n\n
+    • Improved visibility of bicycle nodes\n\n
+    • Tracks are now tappable, have context menu with basic info\n\n
     • Improved "Search" algorithms\n\n
     • Improved "Follow track" options in Navigation\n\n
     • Fixed issues with import/export of profile settings\n\n
@@ -78,8 +78,8 @@
     Next, snap your track to the nearest allowed road with one of your navigation profiles to use this option.
     Next segment
     Whole track
-    Select how to connect points, with a straight line, or calculate a route between them with selected profile.
-    Only the next segment will be recalculated using selected profile.
+    Select how to connect points, by a straight line, or calculate a route between them as specified below.
+    Only the next segment will be recalculated using the selected profile.
     The whole track will be recalculated using the selected profile.
     Reverse route
     Save as new track

From d1dbc4a4a44c4b71fabefdb26d7c051cd172c6a1 Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Mon, 14 Sep 2020 22:30:25 +0300
Subject: [PATCH 06/29] Remove search from onBackPressed

---
 .../osmand/plus/activities/MapActivity.java   |  6 +----
 .../MapContextMenuFragment.java               | 22 +++++++++++--------
 .../search/QuickSearchDialogFragment.java     | 15 ++++++++++++-
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 45b4e8c105..7b152c5ec5 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -657,14 +657,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 			closeDrawer();
 			return;
 		}
-		if (getQuickSearchDialogFragment() != null) {
-			showQuickSearch(ShowQuickSearchMode.CURRENT, false);
-			return;
-		}
 		if (getMapLayers().getContextMenuLayer().isInAddGpxPointMode()) {
 			quitAddGpxPointMode();
 		}
-		if (launchPrevActivityIntent()) {
+		if (!getOnBackPressedDispatcher().hasEnabledCallbacks() && launchPrevActivityIntent()) {
 			return;
 		}
 		super.onBackPressed();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 7a53629f4d..5f88a13607 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -168,17 +168,21 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
 	@Override
 	public void onCreate(@Nullable Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
-		requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
-			public void handleOnBackPressed() {
-				if (menu.isVisible() && menu.isClosable()) {
-					if (menu.getCurrentMenuState() != MenuState.HEADER_ONLY && !menu.isLandscapeLayout()) {
-						menu.openMenuHeaderOnly();
-					} else {
-						menu.close();
+		MapActivity mapActivity = getMapActivity();
+		if (mapActivity != null) {
+			boolean enabled = mapActivity.getQuickSearchDialogFragment() == null;
+			mapActivity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(enabled) {
+				public void handleOnBackPressed() {
+					if (menu.isVisible() && menu.isClosable()) {
+						if (menu.getCurrentMenuState() != MenuState.HEADER_ONLY && !menu.isLandscapeLayout()) {
+							menu.openMenuHeaderOnly();
+						} else {
+							menu.close();
+						}
 					}
 				}
-			}
-		});
+			});
+		}
 	}
 
 	@Override
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
index 0e34a4ca35..3c55261668 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
@@ -34,6 +34,7 @@ import android.widget.ProgressBar;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.activity.OnBackPressedCallback;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
@@ -41,6 +42,7 @@ import androidx.appcompat.widget.Toolbar;
 import androidx.core.content.ContextCompat;
 import androidx.fragment.app.DialogFragment;
 import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentPagerAdapter;
 import androidx.fragment.app.FragmentTransaction;
@@ -232,13 +234,24 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
 	@Override
 	public void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
+		FragmentActivity activity = requireActivity();
 		app = getMyApplication();
 		nightMode = !app.getSettings().isLightContent();
 		navigationInfo = new NavigationInfo(app);
-		accessibilityAssistant = new AccessibilityAssistant(getActivity());
+		accessibilityAssistant = new AccessibilityAssistant(activity);
+
 		boolean isLightTheme = app.getSettings().isLightContent();
 		int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
 		setStyle(STYLE_NO_FRAME, themeId);
+
+		activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+			public void handleOnBackPressed() {
+				MapActivity mapActivity = getMapActivity();
+				if (mapActivity != null) {
+					mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
+				}
+			}
+		});
 	}
 
 	@Override

From 7d72f0fb92fbfeb340d6a06e6d30ffe4627b1015 Mon Sep 17 00:00:00 2001
From: Hardy 
Date: Mon, 14 Sep 2020 22:30:14 +0200
Subject: [PATCH 07/29] Update strings.xml

---
 OsmAnd/res/values/strings.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 5df1c73d6e..7e80b4c02d 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -13,9 +13,9 @@
 -->
     
     • Updated "Plan a route" function: allows using different navigation types per segment and the inclusion of tracks\n\n
-    • New "Appearance" menu for tracks: select color, thickness, and direction arrows. Tracks now indicate start/finish icons.\n\n
-    • Improved visibility of bicycle nodes\n\n
-    • Tracks are now tappable, have context menu with basic info\n\n
+    • New "Appearance" menu for tracks: select color, thickness, display direction arrows, start/finish icons\n\n
+    • Improved visibility of bicycle nodes.\n\n
+    • Tracks are now tappable, have context menu with basic info.\n\n
     • Improved "Search" algorithms\n\n
     • Improved "Follow track" options in Navigation\n\n
     • Fixed issues with import/export of profile settings\n\n

From fae5d95dbd6b5cc96133179ab886eaada5757cdf Mon Sep 17 00:00:00 2001
From: Hardy 
Date: Mon, 14 Sep 2020 22:38:31 +0200
Subject: [PATCH 08/29] Update strings.xml

---
 OsmAnd/res/values/strings.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 7e80b4c02d..3f8159283b 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -51,7 +51,7 @@
     Nearest point
     Start of the track
     Point of the track to navigate
-    Navigate from my location to the track
+    Navigate from my position to the track
     Select another track
     Choose track file to follow or import it from your device.
     Choose track file to follow

From 454ab23eed444d1b7dd099109fba18332a6ed59e Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 01:57:21 +0300
Subject: [PATCH 09/29] Refactor createUniqueFileName

---
 .../main/java/net/osmand/util/Algorithms.java |  2 +-
 OsmAnd/src/net/osmand/FileUtils.java          | 29 +++++++------------
 .../src/net/osmand/plus/MapMarkersHelper.java | 12 ++++----
 .../plus/activities/MapActivityActions.java   | 18 +++++-------
 .../CoordinateInputDialogFragment.java        | 14 ++++-----
 .../SaveAsTrackBottomSheetDialogFragment.java | 22 +++++---------
 .../MeasurementToolFragment.java              |  6 +++-
 .../ChooseRouteFragment.java                  | 25 ++++++++--------
 8 files changed, 56 insertions(+), 72 deletions(-)

diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
index 21e7fbd58c..ea2869aaa3 100644
--- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
+++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
@@ -119,7 +119,7 @@ public class Algorithms {
 	}
 
 	public static String getFileNameWithoutExtension(String name) {
-		int i = name.indexOf('.');
+		int i = name.lastIndexOf('.');
 		if (i >= 0) {
 			name = name.substring(0, i);
 		}
diff --git a/OsmAnd/src/net/osmand/FileUtils.java b/OsmAnd/src/net/osmand/FileUtils.java
index 222b706e3c..59fb36c88d 100644
--- a/OsmAnd/src/net/osmand/FileUtils.java
+++ b/OsmAnd/src/net/osmand/FileUtils.java
@@ -8,6 +8,7 @@ import android.view.View;
 import android.widget.EditText;
 import android.widget.Toast;
 
+import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
 
 import net.osmand.plus.GpxSelectionHelper;
@@ -19,14 +20,8 @@ import net.osmand.util.Algorithms;
 
 import java.io.File;
 import java.lang.ref.WeakReference;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
 import java.util.regex.Pattern;
 
-import static net.osmand.IndexConstants.GPX_FILE_EXT;
-import static net.osmand.IndexConstants.GPX_INDEX_DIR;
-
 public class FileUtils {
 
 	public static final Pattern ILLEGAL_FILE_NAME_CHARACTERS = Pattern.compile("[?:\"*|/<>]");
@@ -171,20 +166,16 @@ public class FileUtils {
 		return dest;
 	}
 
-	public static String createName(OsmandApplication app) {
-		String displayedName;
-		final String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
-		displayedName = suggestedName;
-		if (app != null) {
-			File dir = app.getAppPath(GPX_INDEX_DIR);
-			File fout = new File(dir, suggestedName + GPX_FILE_EXT);
-			int ind = 0;
-			while (fout.exists()) {
-				displayedName = suggestedName + "_" + (++ind);
-				fout = new File(dir, displayedName + GPX_FILE_EXT);
-			}
+	public static String createUniqueFileName(@NonNull OsmandApplication app, String name, String dirName, String extension) {
+		String uniqueFileName = name;
+		File dir = app.getAppPath(dirName);
+		File fout = new File(dir, name + extension);
+		int ind = 0;
+		while (fout.exists()) {
+			uniqueFileName = name + "_" + (++ind);
+			fout = new File(dir, uniqueFileName + extension);
 		}
-		return displayedName;
+		return uniqueFileName;
 	}
 
 	public interface RenameCallback {
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index 322c19e8e4..636fcddb72 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
 import androidx.core.content.ContextCompat;
 
 import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
 import net.osmand.GPXUtilities;
 import net.osmand.GPXUtilities.GPXFile;
 import net.osmand.GPXUtilities.WptPt;
@@ -1005,15 +1006,14 @@ public class MapMarkersHelper {
 	}
 
 	public String generateGpx(String fileName) {
-		final File dir = ctx.getAppPath(IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR);
+		String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+		File dir = ctx.getAppPath(dirName);
 		if (!dir.exists()) {
 			dir.mkdirs();
 		}
-		File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
-		int ind = 1;
-		while (fout.exists()) {
-			fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
-		}
+		String uniqueFileName = FileUtils.createUniqueFileName(ctx, fileName, dirName, IndexConstants.GPX_FILE_EXT);
+		File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT);
+
 		GPXFile file = new GPXFile(Version.getFullVersion(ctx));
 		for (MapMarker marker : mapMarkers) {
 			WptPt wpt = new WptPt();
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index 9ba64ab50e..19d273c9ca 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -294,8 +294,7 @@ public class MapActivityActions implements DialogProvider {
 					dlg.findViewById(R.id.DuplicateFileName).setVisibility(View.VISIBLE);
 				} else {
 					dlg.dismiss();
-					new SaveDirectionsAsyncTask(app, false)
-							.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
+					new SaveDirectionsAsyncTask(app, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
 				}
 			}
 		});
@@ -325,8 +324,8 @@ public class MapActivityActions implements DialogProvider {
 		protected GPXFile doInBackground(File... params) {
 			if (params.length > 0) {
 				File file = params[0];
-				String fileName = file.getName();
-				GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0, fileName.length() - GPX_FILE_EXT.length()));
+				String fileName = Algorithms.getFileNameWithoutExtension(file);
+				GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName);
 				gpx.error = GPXUtilities.writeGpxFile(file, gpx);
 				return gpx;
 			}
@@ -335,19 +334,18 @@ public class MapActivityActions implements DialogProvider {
 
 		@Override
 		protected void onPostExecute(GPXFile gpxFile) {
-			if (gpxFile.error != null) {
+			if (gpxFile.error == null) {
+				app.getSelectedGpxHelper().selectGpxFile(gpxFile, showOnMap, false);
+				String result = app.getString(R.string.route_successfully_saved_at, gpxFile.tracks.get(0).name);
+				Toast.makeText(app, result, Toast.LENGTH_LONG).show();
+			} else {
 				String errorMessage = gpxFile.error.getMessage();
 				if (errorMessage == null) {
 					errorMessage = app.getString(R.string.error_occurred_saving_gpx);
 				}
 				Toast.makeText(app, errorMessage, Toast.LENGTH_LONG).show();
-				return;
 			}
-			app.getSelectedGpxHelper().selectGpxFile(gpxFile, showOnMap, false);
-			String result = app.getString(R.string.route_successfully_saved_at, gpxFile.tracks.get(0).name);
-			Toast.makeText(app, result, Toast.LENGTH_LONG).show();
 		}
-
 	}
 
 	public void addActionsToAdapter(final double latitude,
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
index 8c36930451..a68bd4c714 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
@@ -43,7 +43,6 @@ import androidx.annotation.DrawableRes;
 import androidx.annotation.IdRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatDelegate;
 import androidx.appcompat.content.res.AppCompatResources;
 import androidx.appcompat.widget.PopupMenu;
 import androidx.core.content.ContextCompat;
@@ -57,6 +56,7 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.google.android.material.snackbar.Snackbar;
 
 import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
 import net.osmand.GPXUtilities;
 import net.osmand.GPXUtilities.GPXFile;
 import net.osmand.GPXUtilities.WptPt;
@@ -67,7 +67,6 @@ import net.osmand.plus.MapMarkersHelper;
 import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
 import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
 import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.settings.backend.OsmandSettings;
 import net.osmand.plus.R;
 import net.osmand.plus.UiUtilities;
 import net.osmand.plus.Version;
@@ -79,6 +78,7 @@ import net.osmand.plus.mapmarkers.CoordinateInputFormats.DDM;
 import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS;
 import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
 import net.osmand.plus.mapmarkers.adapters.CoordinateInputAdapter;
+import net.osmand.plus.settings.backend.OsmandSettings;
 import net.osmand.plus.widgets.EditTextEx;
 import net.osmand.util.Algorithms;
 import net.osmand.util.LocationParser;
@@ -1498,15 +1498,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
 		protected Void doInBackground(Void... params) {
 			if (Algorithms.isEmpty(gpx.path)) {
 				if (!Algorithms.isEmpty(fileName)) {
-					final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR);
+					String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+					File dir = app.getAppPath(dirName);
 					if (!dir.exists()) {
 						dir.mkdirs();
 					}
-					File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
-					int ind = 1;
-					while (fout.exists()) {
-						fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
-					}
+					String uniqueFileName = FileUtils.createUniqueFileName(app, fileName, dirName, IndexConstants.GPX_FILE_EXT);
+					File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT);
 					GPXUtilities.writeGpxFile(fout, gpx);
 				}
 			} else {
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
index f176437ebd..a2a72d3f64 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
@@ -21,6 +21,7 @@ import androidx.core.content.ContextCompat;
 import com.google.android.material.textfield.TextInputLayout;
 
 import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
 import net.osmand.IndexConstants;
 import net.osmand.plus.OsmandApplication;
 import net.osmand.plus.R;
@@ -28,7 +29,6 @@ import net.osmand.plus.base.BottomSheetDialogFragment;
 import net.osmand.plus.helpers.AndroidUiHelper;
 import net.osmand.plus.widgets.OsmandTextFieldBoxes;
 
-import java.io.File;
 import java.util.Date;
 
 import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.ADDED_POINTS_NUMBER_KEY;
@@ -85,21 +85,13 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
 			}
 		}
 
-		final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/map markers");
-		if (!dir.exists()) {
-			dir.mkdirs();
-		}
 		Date date = new Date();
-		final String suggestedName = app.getString(R.string.markers) + "_" + DateFormat.format("yyyy-MM-dd", date).toString();
-		String displayedName = suggestedName;
-		File fout = new File(dir, suggestedName + IndexConstants.GPX_FILE_EXT);
-		int ind = 1;
-		while (fout.exists()) {
-			displayedName = suggestedName + "_" + (++ind);
-			fout = new File(dir, displayedName + IndexConstants.GPX_FILE_EXT);
-		}
-		final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
-		nameEditText.setText(displayedName);
+		String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+		String suggestedName = app.getString(R.string.markers) + "_" + DateFormat.format("yyyy-MM-dd", date).toString();
+		String uniqueFileName = FileUtils.createUniqueFileName(app, suggestedName, dirName, IndexConstants.GPX_FILE_EXT);
+
+		final EditText nameEditText = mainView.findViewById(R.id.name_edit_text);
+		nameEditText.setText(uniqueFileName);
 		nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor));
 
 		mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index 5e2f1befdf..3c87f6a7f3 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -86,8 +86,11 @@ import net.osmand.util.Algorithms;
 import java.io.File;
 import java.lang.ref.WeakReference;
 import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import static net.osmand.IndexConstants.GPX_FILE_EXT;
 import static net.osmand.IndexConstants.GPX_INDEX_DIR;
@@ -1443,7 +1446,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
 		GpxData gpxData = editingCtx.getGpxData();
 		String displayedName;
 		if (gpxData == null) {
-			displayedName = FileUtils.createName(getMyApplication());
+			String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
+			displayedName = FileUtils.createUniqueFileName(requireMyApplication(), suggestedName, GPX_INDEX_DIR, GPX_FILE_EXT);
 		} else {
 			displayedName = AndroidUtils.trimExtension(new File(gpxData.getGpxFile().path).getName());
 		}
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
index b3e773c881..3f690c1d81 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
@@ -56,12 +56,12 @@ import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.CumulativeInfo;
 import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.RouteDetailsFragmentListener;
 import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
 import net.osmand.plus.routing.RouteDirectionInfo;
-import net.osmand.plus.routing.RouteProvider;
+import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
 import net.osmand.plus.routing.RoutingHelper;
 import net.osmand.plus.routing.TransportRoutingHelper;
 import net.osmand.plus.settings.backend.OsmandSettings;
-import net.osmand.plus.views.layers.MapControlsLayer;
 import net.osmand.plus.views.OsmandMapTileView;
+import net.osmand.plus.views.layers.MapControlsLayer;
 import net.osmand.router.TransportRouteResult;
 import net.osmand.util.Algorithms;
 
@@ -81,8 +81,8 @@ import static net.osmand.IndexConstants.GPX_FILE_EXT;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID;
 import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
-import static net.osmand.plus.activities.MapActivityActions.*;
-import static net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment.*;
+import static net.osmand.plus.activities.MapActivityActions.SaveDirectionsAsyncTask;
+import static net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment.SaveAsNewTrackFragmentListener;
 
 public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMenuFragmentListener,
 		RouteDetailsFragmentListener, SaveAsNewTrackFragmentListener {
@@ -467,15 +467,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
 			@Override
 			public void onClick(View v) {
 				MapActivity mapActivity = getMapActivity();
-				OsmandApplication app = getMyApplication();
-				if (mapActivity != null && app != null) {
-					RoutingHelper routingHelper = app.getRoutingHelper();
-					final RouteProvider.GPXRouteParamsBuilder rp = routingHelper.getCurrentGPXRoute();
-					final String fileName;
-					if (rp == null || rp.getFile() == null || rp.getFile().path == null) {
-						fileName = FileUtils.createName(app);
+				if (mapActivity != null) {
+					OsmandApplication app = mapActivity.getMyApplication();
+					GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
+
+					String fileName;
+					if (paramsBuilder == null || paramsBuilder.getFile() == null || paramsBuilder.getFile().path == null) {
+						String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
+						fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT);
 					} else {
-						fileName = new File(rp.getFile().path).getName();
+						fileName = new File(paramsBuilder.getFile().path).getName();
 					}
 					SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(),
 							ChooseRouteFragment.this, null, fileName,

From af0c40bb41fd5892c2d599242eaadf24803c9cf3 Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 02:02:16 +0300
Subject: [PATCH 10/29] Remove unnecessary check

---
 OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 7b152c5ec5..e23e596dcf 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -660,14 +660,14 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
 		if (getMapLayers().getContextMenuLayer().isInAddGpxPointMode()) {
 			quitAddGpxPointMode();
 		}
-		if (!getOnBackPressedDispatcher().hasEnabledCallbacks() && launchPrevActivityIntent()) {
+		if (getSupportFragmentManager().getBackStackEntryCount() == 0 && launchPrevActivityIntent()) {
 			return;
 		}
 		super.onBackPressed();
 	}
 
 	public boolean launchPrevActivityIntent() {
-		if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
+		if (prevActivityIntent != null) {
 			prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
 			LatLon loc = getMapLocation();
 			prevActivityIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());

From a7d77dc5f28acbc79fecf7f1cfb40ac1a63ec4d9 Mon Sep 17 00:00:00 2001
From: xmd5a 
Date: Tue, 15 Sep 2020 12:07:43 +0300
Subject: [PATCH 11/29] Add phrase

---
 OsmAnd/res/values/phrases.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml
index fe274284d9..cd482756ec 100644
--- a/OsmAnd/res/values/phrases.xml
+++ b/OsmAnd/res/values/phrases.xml
@@ -4253,4 +4253,6 @@
 	Realtime
 	Timetable
 
+	Beehive
+
 

From 0bccf22beb30a58217909d3f04bb7a0f8d0053bb Mon Sep 17 00:00:00 2001
From: josep constanti 
Date: Mon, 14 Sep 2020 17:52:16 +0000
Subject: [PATCH 12/29] Translated using Weblate (Catalan)

Currently translated at 96.0% (3345 of 3484 strings)
---
 OsmAnd/res/values-ca/strings.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml
index b6944c01bf..4ae94a57c7 100644
--- a/OsmAnd/res/values-ca/strings.xml
+++ b/OsmAnd/res/values-ca/strings.xml
@@ -3812,4 +3812,7 @@ Abasta l\'àrea: %1$s x %2$s
     REC
     Aturarà l\'enregistrament de traces quan es mati l\'aplicació (mitjançant aplicacions recents). (La indicació de fons OsmAnd desapareix de la barra de notificacions d\'Android.)
     Trieu l\'interval d\'enregistrament general dels desplaçaments (s\'activa mitjançant el giny de gravació del mapa).
+    Traça simplificada
+    Només es desarà la línia del trajecte, les fites s\'esborraran.
+    %s arxius de traces seleccionats
 
\ No newline at end of file

From 5b946a08800685ee0943f772f3b2e85b2c35bda9 Mon Sep 17 00:00:00 2001
From: Hinagiku Zeppeki 
Date: Sun, 13 Sep 2020 09:00:03 +0000
Subject: [PATCH 13/29] Translated using Weblate (Japanese)

Currently translated at 97.9% (3414 of 3484 strings)
---
 OsmAnd/res/values-ja/strings.xml | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml
index 4e8391bc49..843dada170 100644
--- a/OsmAnd/res/values-ja/strings.xml
+++ b/OsmAnd/res/values-ja/strings.xml
@@ -3863,4 +3863,31 @@ POIの更新は利用できません
     次年度以降 %1$s
     初%2$s度 %1$s
     初%2$s度 %1$s
+    ルート記録を一時停止
+    ルート記録を続行
+    システムのデフォルト
+    以後のすべてのセグメントは、選択したプロファイルを使用して再計算されます。
+    以後のすべてのセグメント
+    前のセグメント
+    以前のすべてのセグメント
+    選択したセグメントのみ、選択したプロファイルを使用して再計算されます。
+    以前のセグメントは、選択したプロファイルを使用して再計算されます。
+    保存した経路を開く
+    少なくとも2つの地点を追加してください。
+    繰り返し
+    • アップデートで追加されたルート計画モードは、セグメントごとに異なるナビゲーションタイプを使用でき、おおまかな指定を実際の道路に沿って反映可能に。
+\n
+\n• 経路の新しい外観オプション : 色、厚さを選択し、方向矢印のオン、マークの開始/終了など
+\n
+\n• 自転車ノードの可視性の向上
+\n
+\n• 基本情報を含む経路のコンテキストメニュー追加
+\n
+\n• 検索アルゴリズムの改善
+\n
+\n• ナビゲーションの追跡オプションの改善
+\n
+\n• プロファイル設定のインポート/エクスポートに関する問題を修正
+\n
+\n
 
\ No newline at end of file

From c6874211dc3b42118b7375b7d2b3bd1cee73d2a5 Mon Sep 17 00:00:00 2001
From: Deelite <556xxy@gmail.com>
Date: Tue, 15 Sep 2020 06:56:11 +0000
Subject: [PATCH 14/29] Translated using Weblate (Russian)

Currently translated at 100.0% (3484 of 3484 strings)
---
 OsmAnd/res/values-ru/strings.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index 8252ed2138..eac0618f0e 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -2357,7 +2357,7 @@
     Сохранить точки, как точки маршрута или как линию.
     Выберите профиль навигации
     %1$d из %2$d
-    Списком
+    Список
     Группы
     Использовано: %1$s
     Сделать активным
@@ -2703,7 +2703,7 @@
     С
     Необязательное имя точки
     Спортивные сплавы
-    По удалённости (сначала дальние)
+    Сначала дальние
     Удалённость (сначала ближние)
     Группа удалена
     Очистить все промежуточные точки
@@ -3833,8 +3833,8 @@
 \nНа следующем шаге необходимо выбрать профиль навигации для определения разрешенных дорог и пороговое расстояние, чтобы приблизительно привязать маршрут к дорогам.
     Выберите способ соединения точек: прямой линией или прокладкой маршрута с выбранным профилем.
     При обратном направлении
-    Вы уверены, что хотите отменить все изменения в запланированном маршруте, закрыв его\?
-    Изображения на уровне улиц
+    Все изменения будут утеряны. Закрыть план маршрута\?
+    Съёмка уличного уровня
     Сохранить как новый файл трека
     Добавить в файл трека
     Треки

From d4c8a20c5d0009c3b07dd188117e11ef6cba22b3 Mon Sep 17 00:00:00 2001
From: Dmitriy Prodchenko 
Date: Mon, 14 Sep 2020 10:35:28 +0000
Subject: [PATCH 15/29] Translated using Weblate (Russian)

Currently translated at 100.0% (3484 of 3484 strings)
---
 OsmAnd/res/values-ru/strings.xml | 40 ++++++++++++++++----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index eac0618f0e..61a1b00868 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -145,9 +145,9 @@
     Фактор рельефа местности (по данным SRTM, ASTER и EU-DEM).
     Действие переименовано в %1$s, чтобы избежать дублирования.
     Обнаружен дубликат имени
-    Переключатель, чтобы показать или скрыть сохранённые точки на карте.
+    Переключатель, чтобы показать или скрыть избранные точки на карте.
     Переключатель, чтобы показать или скрыть POI на карте.
-    Показать/скрыть Мои места
+    Показать/скрыть избранные
     Добавить категорию
     Действия
     Если оставить это поле пустым, то оно будет автоматически заполнено адресом или названием места.
@@ -462,7 +462,7 @@
     Определение положения…
     Моё местоположение (найдено)
     Адрес…
-    Сохранённые…
+    Избранные…
     Неопределённо
     Текущий центр карты
     Начало:
@@ -475,7 +475,7 @@
     Отправить в OSM
     Детализированная карта
     Показывать детали (дороги и др.), начиная с мелких масштабов.
-    Сохранённые места удалены.
+    Избранные точки удалены.
     Вы уверены, что хотите удалить %1$d избранных и %2$d избранных групп\?
     Дом
     Друзья
@@ -610,7 +610,7 @@
 \nНавигация временно переключена на онлайн-сервис CloudMade.
     Невозможно найти указанную папку.
     Папка хранилища данных
-    У вас установлена предыдущая версия OsmAnd. Все локальные данные поддерживаются новой версией. Однако сохранённые точки нужно вручную экспортировать из старой версии и импортировать в новую.
+    У вас установлена предыдущая версия OsmAnd. Все локальные данные поддерживаются новой версией. Однако избранные точки нужно выгрузить из предыдущей версии приложения и загрузить в новую.
     Сборка {0} успешно установлена ({1}).
     Загружается сборка…
     Установить OsmAnd — {0} из {1} {2} МБ\?
@@ -675,7 +675,7 @@
     Выравнивание карты:
     Ориентация карты
     Детали маршрута
-    Сохранённые успешно импортированы
+    Избранные точки успешно импортированы
     GPX-файл с сохранёнными точками отсутствует в {0}
     Точки сохранены в {0}
     Нет избранных точек для сохранения
@@ -796,7 +796,7 @@
     Загружается список доступных регионов…
     Не удалось получить список регионов с https://osmand.net.
     Отредактирована избранная точка
-    Нет сохранённых точек
+    Избранные точки отсутствуют
     Заменить
     Только показать
     Запуск сопровождения
@@ -906,11 +906,11 @@
     Отмена
     Нет
     Название точки
-    Сохранённая
-    Точка «{0}» сохранена.
+    Избранная
+    Точка «{0}» была успешно добавлена к избранным.
     Редактировать место
     Удалить из моих
-    Удалить точку «%s» из сохранённых\?
+    Удалить точку «%s» из избранных\?
     Точка {0} удалена.
     Комментарий добавлен
     Не удалось добавить комментарий.
@@ -1460,7 +1460,7 @@
     Мировые пункты обмена bitcoin
     дней
     Соединение
-    Сохранить данные в файл GPX или импортировать путевые точки в Мои места\?
+    Сохранить данные как трек файл или импортировать путевые точки в избранные\?
     Розовый
     Коричневый
     Пустой файл GPX
@@ -1701,7 +1701,7 @@
     Переименовать
     Удалить
     Удалить все
-    Сохранить
+    Добавить
     Применить
     Старт
     Стоп
@@ -1722,7 +1722,7 @@
     Показывать на карте
     Карта
     Сохранено
-    Сохранённые
+    Избранные
     Добавить к избранным
     Аудио
     Видео
@@ -1958,7 +1958,7 @@
     Опасность
     Регионы
     Карты мира
-    Добавить в избранное
+    Добавить в избранные
     Региональные карты
     Задайте название, которое ещё не используется.
     Название категории
@@ -2207,7 +2207,7 @@
     Очистить всю плитку
     Снижать расход топлива
     Использование топливо-сберегающего пути (обычно короче).
-    Вы уверены, что хотите заменить %1$s\?
+    Вы уверены, что хотите заменить избранные %1$s\?
     Изменить
     Начать
     от
@@ -2264,11 +2264,11 @@
     Добавить место парковки
     Добавить действие
     Редактировать действие
-    Добавить в избранное
+    Добавить в избранные
     Добавить действие
     Удалить действие
     Вы уверены, что хотите удалить действие «%s»\?
-    Показать сохранённые
+    Показать избранные
     Скрыть сохранённые
     Показать/скрыть POI
     Показать %1$s
@@ -2476,7 +2476,7 @@
     Налево
     Показать цифровую панель
     Нажатие на карте переключает кнопки управления и виджеты.
-    возможет импорт в сохранённые точки или как файл GPX.
+    возможен импорт в избранные точки или как трек файл.
     Больше
     Импортировать как файл GPX
     Импортировать в Мои места
@@ -2583,7 +2583,7 @@
     Сохранить точку маршрута
     Путевая точка 1
     Точка маршрута 1
-    Добавить сохранённые
+    Добавить избранные
     Избранное можно импортировать или создать, отмечая точки на карте.
     Импортировать файл GPX
     Переместить точку
@@ -3346,7 +3346,7 @@
     Положение значка в состоянии покоя
     После нажатия кнопки «Применить» удалённые профили будут полностью потеряны.
     Базовый профиль
-    Цвет
+    Выберите цвет
     Вы не можете удалить стандартные профили OsmAnd, но вы можете отключить их на предыдущем экране или переместить вниз.
     Редактировать профили
     «Тип навигации» определяет способ расчета маршрутов.

From ec77d6dd06732267170ab2347bf066817838a4f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Babos=20G=C3=A1bor?= 
Date: Mon, 14 Sep 2020 15:38:27 +0000
Subject: [PATCH 16/29] Translated using Weblate (Hungarian)

Currently translated at 100.0% (3484 of 3484 strings)
---
 OsmAnd/res/values-hu/strings.xml | 61 +++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 24 deletions(-)

diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml
index 0be4073d8b..bf5f700fa4 100644
--- a/OsmAnd/res/values-hu/strings.xml
+++ b/OsmAnd/res/values-hu/strings.xml
@@ -134,11 +134,11 @@
     Térképforrás beállítások
     Vektoros térkép beállítások
     Biztosan törli: %1$s\?
-    településrész
-    falucska
-    község
-    város
-    város
+    Településrész
+    Falucska
+    Község
+    Kisváros
+    Város
     Szimuláció leállítása
     Szimuláció indítása
     Nem sikerült átnevezni a fájlt.
@@ -350,7 +350,7 @@
     Megjelenítési stílus kiválasztása
     POI weboldal megtekintése
     POI telefonszám megtekintése
-    weboldal
+    Weboldal
     telefon
     szűrés
     Nagy felbontású kijelző
@@ -901,7 +901,7 @@
     Lejátszás
     Felvétel
     Indítás
-    hang/videojegyzetek
+    Hang/videojegyzetek
     OsmAnd-bővítmény offline szintvonalakhoz
     Távolságmérés
     Készítsen hang/fénykép/videó jegyzeteket utazás közben egy térképen lévő gomb vagy egy pozíció helyi menüjének használatával.
@@ -1727,7 +1727,7 @@
     Telepítés és hibaelhárítás
     Technikai cikkek
     Verziók
-    szavazás
+    Visszajelzés
     Kapcsolat
     Bővebben
     Újdonságok
@@ -2493,9 +2493,9 @@
     A csoport összes pontja
     Nyitva ekkortól:
     Nyitva eddig:
-    Ekkor fog bezárni:
-    Ekkor fog kinyitni:
-    Ekkor fog kinyitni:
+    Bezár ekkor:
+    Kinyit ekkor:
+    Kinyit ekkor:
     További műveletek
     GPX fájl a kijelölt jegyzetek koordinátáival és adataival.
     GPX fájl az összes jegyzet koordinátáival és adataival.
@@ -2747,8 +2747,8 @@
     Köztes célpont hozzáadása
     Kiindulópont megadása
     Köztes célpont
-    átszállások
-    gyalog
+    Átszállások
+    Gyalog
     Út
     Érdekes helyek (POI)
     Útvonal tervezése…
@@ -3314,7 +3314,7 @@
     Profilok listájának szerkesztése
     Kiválasztott profil
     A létrehozandó egyedi profil az alkalmazás egyik alapprofilján fog alapulni, ez határozza meg az alapvető beállításokat, mint például a widgetek láthatóságát vagy a sebesség és távolság mértékegységeit. Ezek az alapprofilok, néhány pédával az egyedi profilokra, amikre kiterjeszthetők:
-    Szerezze meg %1$d %2$s %3$s kedvezménnyel
+    Szerezze meg %1$d %2$s %3$s kedvezménnyel.
     %1$s az első %2$s
     %1$s az első %2$s
     utána %1$s
@@ -3702,7 +3702,7 @@
     Bizonyos országokban a traffipax riasztások törvényileg tiltottak.
     Tájolás
     %1$s törölve
-    A traffipax adatok végleges eltávolításához újraindítás szükséges.
+    A traffipaxadatok végleges törléséhez indítsa újra az alkalmazást.
     Eltávolítás és Újraindítás
     Adja meg az útvonalakon a járművekre vonatkozó hosszkorlátozást.
     Hosszkorlátozás
@@ -3728,12 +3728,12 @@
     Legkisebb pontosság
     Legkisebb elmozdulás
     Bővítménybeállítások visszaállítása alapértelmezettre
-    Engedélyezésével a térkép nagyítási szintje az eszköz hangerőgombjaival állítható.
+    A térképnagyítás szintjének vezérlése a készülék hangerőgombjaival.
     Hangerőgombok használata nagyításhoz
     Görkorcsolya
     Kérem, adjon nevet a pontnak
     Adja meg a járműve hosszát (a hosszú járművekre útvonalkorlátozások vonatkozhatnak).
-    Következő célpont törlése
+    Legközelebbi célpont törlése
     Wikipédia térképek letöltése
     További adatokat is kijelölhet exportálásra a profillal együtt.
     Kiegészítő adatok átvétele
@@ -3745,14 +3745,14 @@
 \n
 \nAz előfizetéseit a Google Play beállításainál tudja kezelni és lemondani.
     Törli az útvonal soron következő célpontját. Amennyiben ez a végző célpont, a navigáció megáll.
-    Szerezzen információt az érdekes helyekkel kapcsolatban a Wikipédiáról. Ez az ön offline zseb útikönyve - egyszerűen engedélyezze a Wikipédia bővítményt és élvezze az ön körül lévő objektumokról szóló cikkeket.
+    Tudjon meg többet az érdekes pontokról a Wikipédiából. Ez az Ön offline zsebútikönyve – egyszerűen kapcsolja be a Wikipédia-bővítményt, és élvezze az Ön körüli objektumokról szóló cikkeket.
     Salakmotor
     Robogó
     Kerekesszék
     Gokart
     Lezárt OSM-jegyzet
     Előre döntött kerekesszék
-    A folytatáshoz adja meg a munkanapokat
+    A folytatáshoz állítsa be a munkanapokat
     Útvonal pontok között
     Útvonaltervezés
     Hozzáadás nyomvonalhoz
@@ -3826,7 +3826,7 @@
     Mentés nyomvonalfájlként
     Másik nyomvonal kiválasztása
     Elmentett nyomvonal megnyitása
-    Válassza ki a követni kívánt nyomvonalfájlt, vagy importáljon egyet.
+    Válassza ki a követni kívánt nyomvonalfájlt, vagy importáljon egyet a készülékéről.
     Irányt mutató nyilak
     Javaslat: Az 5 méteres beállítás megfelelő lehet, ha nem szükséges ennél finomabb részleteket rögzítenie, és nyugalmi állapotban sem akar kifejezetten adatokat rögzíteni.
     Következő szakasz
@@ -3848,9 +3848,7 @@
     Tömör
     Adja meg a címet
     Csak a következő szakasz lesz újraszámítva a kiválasztott profilnak megfelelően.
-    Ennek a beállításnak a használatához az OsmAndnak hozzá kell tördelnie a nyomvonalát a térképen található utakhoz.
-\n
-\n A következő lépésben ki kell választania a navigációs profilt az engedélyezett utak és a küszöbtávolság észleléséhez, hogy a nyomvonalát közelíteni lehessen az utakhoz.
+    Ezután a beállítás használatához igazítsa a nyomvonalat a legközelebbi úthoz az egyik navigációs profil segítségével.
     Egyedi
     Utazás rögzítésének szüneteltetése
     Mentés új nyomvonalfájlként
@@ -3861,7 +3859,7 @@
     Navigációs profil
     Megjegyzés a „sebesség > 0” ellenőrzéséhez: A legtöbb GPS lapkakészlet (chipset) csak akkor mutat sebességértéket, ha az algoritmus megállapítja, hogy mozgásban van. Ha nincs mozgás, akkor nem mutatnak sebességet. Ezért ebben a szűrőben a „> 0” beállítás bizonyos értelemben a GPS lapkakészlet mozgásérzékelését használja. De – még ha a rögzítés ideje alatt itt nem is szűrjük – a GPX elemzése során mégis használjuk ezt a funkciót a korrigált távolság meghatározásához, vagyis az abban a mezőben megjelenített érték a mozgás közben rögzített távolság.
     Csak a kijelölt szakasz lesz újraszámítva a kiválasztott profilnak megfelelően.
-    Biztos, hogy mentés nélkül bezárja az útvonaltervezőt\? Minden változást elveszít.
+    Biztos, hogy mentés nélkül bezárja az útvonaltervezőt\? Minden változást elvész.
     Válassza ki a követendő nyomvonalfájlt
     A felsorolt %1$s már létezik az OsmAndban.
     Minden korábbi szakasz
@@ -3880,4 +3878,19 @@
     Jelölje ki azt a nyomvonalfájlt, amelyhez az új szakasz hozzáadódjék.
     Nyomvonalak
     Mégis
+    • A Tervezett útvonal mód frissítésével különböző navigációtípusok is használathatók az egyes szakaszokhoz, és bármilyen nyomvonal az utakhoz köthető
+\n
+\n • Új megjelenési lehetőségek a nyomvonalakhoz: válassza ki a színt, a vastagságot, kapcsolja be az iránynyilakat és a kezdő / befejező jeleket
+\n
+\n • A kerékpáros csomópontok jobb láthatósága
+\n
+\n • Helyi menü a nyomvonalak az alapvető adataival
+\n
+\n • Továbbfejlesztett keresési algoritmusok
+\n
+\n • Javított nyomvonalkövetési beállítások a Navigációban
+\n
+\n • Javítva a profilbeállítások importálásával / exportálásával kapcsolatos problémák
+\n
+\n
 
\ No newline at end of file

From a252a2a4ce22d93620fc56726cac76904638ccb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Iv=C3=A1ns?= 
Date: Mon, 14 Sep 2020 23:41:04 +0000
Subject: [PATCH 17/29] Translated using Weblate (Galician)

Currently translated at 97.8% (3408 of 3484 strings)
---
 OsmAnd/res/values-gl/strings.xml | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml
index 283c4ba01c..9b411b0d7f 100644
--- a/OsmAnd/res/values-gl/strings.xml
+++ b/OsmAnd/res/values-gl/strings.xml
@@ -3839,4 +3839,17 @@ Lon %2$s
     Personalizado
     Frechas de dirección
     Sólido
+    Deter a gravación da viaxe
+    Retomar a gravación da viaxe
+    Predefinido do sistema
+    Todos os segmentos seguintes
+    Segmento anterior
+    Todos os segmentos anteriores
+    Só o segmento marcado será recalculado empregando o perfil escollido.
+    Todos os segmentos seguintes serán recalculados empregando o perfil escollido.
+    Todos os segmentos anteriores serán recalculados empregando o perfil escollido.
+    Abrir pista gardada
+    está gardado
+    Engade polo menos dous puntos.
+    Refacer
 
\ No newline at end of file

From 1abca0d0fd9a7dd120e647963333cf77e258be5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Babos=20G=C3=A1bor?= 
Date: Mon, 14 Sep 2020 15:44:53 +0000
Subject: [PATCH 18/29] Translated using Weblate (Hungarian)

Currently translated at 99.9% (3819 of 3822 strings)
---
 OsmAnd/res/values-hu/phrases.xml | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/OsmAnd/res/values-hu/phrases.xml b/OsmAnd/res/values-hu/phrases.xml
index d5738abcb9..891959e0b0 100644
--- a/OsmAnd/res/values-hu/phrases.xml
+++ b/OsmAnd/res/values-hu/phrases.xml
@@ -1863,7 +1863,7 @@
     Cserkésztáborhely
     Nomád
     Típus
-    Autós
+    Autós (drive-in)
     Szolgáltatás
     Típus
     Elfogadott hulladék
@@ -3050,7 +3050,7 @@
     Dagadóláp (palsa-láp)
     Avgas 100LL repülőbenzin
     Jet A-1 kerozin
-    AdBlue adalékanyag
+    Diesel kipufogó-folyadék
     Szolgáltatóközpont hátrányos helyzetűeknek
     Erődítmény típusa: földsánc
     Erődítmény típusa: újkőkori körárok
@@ -3808,7 +3808,7 @@
     Cső
     Ivóvíz-utántöltő hálózat
     Ivóvíz-utántöltés nincs
-    Ivóvíz-utántöltés
+    van
     Vízszint: közepes vízszint alatt
     Vízszint: közepes vízszint fölött
     Vízszint: lebegő
@@ -3821,4 +3821,16 @@
     Félrevezető
     Véletlenül használható más elemek
     Kontrasztos színű
+    Menetrend
+    Valós idejű
+    Késés
+    van
+    Indulásiidő-kijelző nincs
+    Lift
+    Nyíl nincs
+    Szivattyú állapota: hiányzik a kar
+    Szívás
+    Kis elektronikus készülékek
+    Indulásiidő-kijelző
+    Ivóvíz-utántöltés
 
\ No newline at end of file

From 6b1cffb6af7373fc057539e26d0243461a83d696 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Priit=20J=C3=B5er=C3=BC=C3=BCt?= 
Date: Sun, 13 Sep 2020 11:02:46 +0000
Subject: [PATCH 19/29] Translated using Weblate (Estonian)

Currently translated at 98.4% (3431 of 3484 strings)
---
 OsmAnd/res/values-et/strings.xml | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml
index 80fdecc6df..b8c7fbfd34 100644
--- a/OsmAnd/res/values-et/strings.xml
+++ b/OsmAnd/res/values-et/strings.xml
@@ -2673,7 +2673,7 @@
     Laiuspiirang
     Määra teedel lubatud sõiduki laius.
     Simuleeri oma asukohta kasutades salvestatud GPX rada.
-    Nupp ekraani keskkoha lähtekohaks muutmiseks ja sihtkohta teekonna arvutamiseks või sihtkoha valimise dialoogi avamiseks kui sihtkoha marker puudub kaardil.
+    Nupp ekraani keskkoha lähtekohaks muutmiseks. Seejärel on kas võimalik valida sihtkohta või alustada teekonna arvutamist.
     See lisa aktiveerib radade salvestamise funktsionaalsuse, puudutades käsitsi kaardil GPX logimisvidinat või logides automaatselt kõik oma navigeerimise marsruudid GPX faili.
 \n
 \nSalvestatud radu saab jagada oma sõpradega või kasutada OSM kaastöödeks. Sportlased saavad kasutada salvestatud radu oma treeningute jälgimiseks. Mõningast raja põhianalüüsi saab teha otse OsmAnd sees, näiteks ringiajad, keskmine kiirus jne. Lisaks muidugi saab radu hiljem analüüsia ka spetsiaalsetete 3. osapoolte analüüsitööriistadega.
@@ -2706,7 +2706,7 @@
     Võimaldab registreerida oma auto parkimiskoha ja jälgida järelejäänud parkimisaega.
 \nNii asukoht kui aeg on nähtavad nii OsmAnd armatuurlaual kui kaardi vidinas. Meeldetuletust saab lisada Androidi kalendrisse.
     Muuda kauguse mõõtmise ühikuid.
-    See lisa annab kaardi vidina, mis võimaldab teekondade loomist kaarti koputades või olemasolevaid GPX-faile kasutades, et reise kavandada ja punktide vahelist kaugust mõõta. Tulemusi saab salvestada GPX-failina, mida saab hiljem juhendamiseks kasutada.
+    Selleks, et reise kavandada ja punktide vahelist kaugust mõõta, loo teekondi kaardil koputades või olemasolevaid GPX-faile kasutades, Tulemusi saad salvestada GPX-failina, mida on hiljem võimalik juhendamiseks kasutada.
     See lisa teeb seadme erivajadusega kasutajatele mõeldud funktsioonid otse OsmAndis kättesaadavaks. See lihtsustab nt. kõnesünteesi häälte kõnekiiruse reguleerimist, ekraanil navigeerimise suuna seadistamist, rulliku kasutamist suurenduse juhtimiseks või kõnesünteesi tagasisidet, näiteks oma asukoha automaatseks teatamiseks.
     See lisa võimaldab OsmAnd abil OSM kaastöid teha, näiteks OSM huvipunkte luua või muuta, OSM märkmeid avada või kommenteerida ning salvestatud GPX faile lisada. OSM on kogukonna juhitud globaalne üldkasutatav kaardistamisprojekt. Üksikasju leiad https://openstreetmap.org. Aktiivset osalemist hinnatakse ja panust saab teha otse OsmAnd rakendusest, kui seadistada rakenduses oma isiklikud OSM kasutajatunnused.
     See lisa kuvab arendus- ja silumisfunktsioonide sätteid nagu teekonna arvutamine, renderdamise jõudlus või hääljuhiste testimine ja simuleerimine. Need seaded on mõeldud arendajatele ja pole tavakasutaja jaoks vajalikud.
@@ -3495,7 +3495,7 @@
     Aragoni
     Lombardi
     Kohandatud värv
-    Jätkamiseks pead valima tööpäevad
+    Jätkamiseks vali tööpäevad
     Teekond punktide vahel
     Kavanda teekonda
     Lisa rajale
@@ -3552,8 +3552,8 @@
     Nupp, mis näitab või peidab kaardil Mapillary kihti.
     Eemalda ja taaskäivita
     Rulluisud
-    Kustuta järgmine sihtpunkt
-    Sisselülitades saad seadme helitugevuse nuppudega kontrollida kaardi suumi taset.
+    Kustuta lähim sihtpunkt
+    Nutiseadme helitugevuse nuppudega kontrollida saad kaardi suumi taset.
     Helitugevuse nupud toimivad suumina
     Palun sisestage punkti nimi
     Lae alla Vikipeedia kaardid
@@ -3582,7 +3582,7 @@
     Pikkuse piirang
     Kurss
     %1$s on kustutatud
-    Selleks, et eemaldada kõik kiiruskaamerate andmed on vajalik seadme taaskäivitamine.
+    Kiiruskaamerate kõikide andmete eemaldamiseks on vajalik nutiseadme taaskäivitamine.
     Siin seadmes puudub teave liikluskaamerate kohta.
     Lisa profiil
     Muuda rakenduse profiili
@@ -3682,7 +3682,7 @@
     Salvesta rada failina
     Jälgi rada
     Vali rajafail, mida soovid kasutada
-    Vali rajafail, mida soovid kasutada või impordi see.
+    Vali rajafail, mida soovid kasutada või impordi see oma nutiseadmest.
     Vali muu rada
     Navigeeri minu asukohast rajale
     Asukoht rajal, kuhu me liigume
@@ -3729,4 +3729,13 @@
     Kinnita teede külge
     Selle valiku kasutamiseks mõne oma navigeerimisprofiili kasutamisel kinnita oma rada lähimale lubatud teele.
     Valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.
+    Põhitegevused
+    Ostu kinnitusel võetakse sinu Google Play kontolt tasu.
+\n
+\nTellimus uuendatakse automaatselt, kui sa seda enne uuendamise kuupäeva ei tühista. Sonu kontolt võetakse pikendamisperioodi eest (kuu/kolm kuud/aasta) tasu ainult uuendamise kuupäeval.
+\n
+\nTellimuste haldamiseks ja tühistamiseks ava Google Play seadistused.
+    Kiirtegevusi saad eksportida või importida koos rakenduse profiilidega.
+    Kas sa oled kindel, et soovid pöördumatult kustutada %d kiirtegevust\?
+    Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda vastavalt oma valitud profiilile.
 
\ No newline at end of file

From 3f733f5ae43bf26fff6d523cb38805f08d1dda88 Mon Sep 17 00:00:00 2001
From: Verdulo 
Date: Mon, 14 Sep 2020 22:01:32 +0000
Subject: [PATCH 20/29] Translated using Weblate (Esperanto)

Currently translated at 99.7% (3812 of 3822 strings)
---
 OsmAnd/res/values-eo/phrases.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OsmAnd/res/values-eo/phrases.xml b/OsmAnd/res/values-eo/phrases.xml
index 41115a7aed..cc31985829 100644
--- a/OsmAnd/res/values-eo/phrases.xml
+++ b/OsmAnd/res/values-eo/phrases.xml
@@ -2335,7 +2335,7 @@
     Akvokrano
     Butonprema: jes
     Butonprema: ne
-    Bicikla mem-riparejo;memriparejo bicikla;riparejo bicikla;pumpilo bicikla;aerpumpilo bicikla
+    Bicikla memriparejo;memriparejo bicikla;riparejo bicikla;pumpilo bicikla;aerpumpilo bicikla
     Aersportoj
     elteriĝejo
     surteriĝejo

From f90825fc370a2855be208bd1be7feaf8454aeda1 Mon Sep 17 00:00:00 2001
From: Selyan Sliman Amiri 
Date: Sun, 13 Sep 2020 08:38:53 +0000
Subject: [PATCH 21/29] Translated using Weblate (Kabyle)

Currently translated at 37.7% (1314 of 3484 strings)
---
 OsmAnd/res/values-b+kab/strings.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/OsmAnd/res/values-b+kab/strings.xml b/OsmAnd/res/values-b+kab/strings.xml
index 43d88c80b1..8a49267439 100644
--- a/OsmAnd/res/values-b+kab/strings.xml
+++ b/OsmAnd/res/values-b+kab/strings.xml
@@ -1339,4 +1339,5 @@
     Amaɣnu n tunigin
     Fren afaylu n uḍfar iɣer ara yernu uḥric amaynut.
     Tebɣiḍ s tidet ad tmedleḍ abrid n uɣawas war asekles\? Ad tesruḥeḍ akk ibeddilen.
+    Ittwasekles
 
\ No newline at end of file

From 7055c20529fd161729b642bddf00f11dd00c9406 Mon Sep 17 00:00:00 2001
From: Jeff Huang 
Date: Mon, 14 Sep 2020 02:00:31 +0000
Subject: [PATCH 22/29] Translated using Weblate (Chinese (Traditional))

Currently translated at 100.0% (3484 of 3484 strings)
---
 OsmAnd/res/values-zh-rTW/strings.xml | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml
index 249e2bfb70..6bed71474e 100644
--- a/OsmAnd/res/values-zh-rTW/strings.xml
+++ b/OsmAnd/res/values-zh-rTW/strings.xml
@@ -3778,27 +3778,27 @@
     某些國家禁止使用測速照相的警報裝置。
     方向
     %1$s 已刪除
-    必須重新啟動才能完全刪除測速照相的資料。
+    重新啟動應用程式以刪除所有測速照相的資料。
     解除安裝並重新啟動
     指定路線上允許的車輛長度。
     長度限制
     此裝置沒有測速照相機。
     直排輪鞋
-    啟用裝置音量按鈕控制地圖縮放等級。
+    使用裝置音量按鈕控制地圖縮放等級。
     音量按鈕以縮放
     提供您的車輛長度,某些路徑限制可能適用於較長的車輛。
-    刪除下一個目的地點
+    刪除最近的目的地點
     請提供點的名稱
     目前路徑上的目的地點將會被刪除。如果其將為目的地,導航就會停止。
     下載維基百科地圖
-    從維基百科取得關於興趣點的資訊。這是您的離線口袋指南 ── 只要啟用維基百科外掛程式並享受有關於您周圍景點的文章。
+    從維基百科取得關於興趣點的資訊。這是您的離線口袋指南 ── 只要開啟維基百科外掛程式並享受有關於您周圍景點的文章。
     耐力賽摩托車
     小型摩托車
     輪椅
     輪椅向前
     卡丁車
     已關閉的 OSM 註記
-    您必須設定工作天以繼續
+    設定工作天以繼續
     點與點之間的路線
     規劃路線
     新增到軌跡
@@ -3824,14 +3824,12 @@
     選取如何連接點,用直線或以選定的設定檔計算其間的路徑。
     整個軌道
     下一段
-    要使用此選項,OsmAnd 必須將您的軌跡捕捉到地圖道路上。
-\n
-\n在下一步,您只需要選取設定檔以偵測允許的道路與距離門檻以追蹤道路。
+    接下來,使用您其中一個導航設定檔來將路線貼齊到最近可用的道路上以使用此選項。
     門檻距離
     導航設定檔
     選取要加入新片段的軌道檔案。
     街道級照片
-    您確定要不儲存就關閉計劃錄線嗎?您將會失去所有變更。
+    您確定要關閉計畫路線來放棄所有變更嗎?
     反向時
     儲存為新的軌跡檔案
     新增到軌跡檔案
@@ -3849,7 +3847,7 @@
     儲存為軌跡檔案
     跟隨軌跡
     選擇要跟隨的軌跡檔案
-    選擇要跟隨的軌跡檔案,或是匯入一個。
+    選擇要跟隨的軌跡檔案,或是從您的裝置匯入。
     選取其他軌跡
     從我的位置導航到軌跡
     要導航的軌跡點

From 47afe0556bd7c5b0da46e22e1714b949af48a1c5 Mon Sep 17 00:00:00 2001
From: Dmitriy Prodchenko 
Date: Mon, 14 Sep 2020 10:35:28 +0000
Subject: [PATCH 23/29] Translated using Weblate (Russian)

Currently translated at 100.0% (267 of 267 strings)

Translation: OsmAnd/Telegram
Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/ru/
---
 OsmAnd-telegram/res/values-ru/strings.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OsmAnd-telegram/res/values-ru/strings.xml b/OsmAnd-telegram/res/values-ru/strings.xml
index b76aa52417..daff0e950b 100644
--- a/OsmAnd-telegram/res/values-ru/strings.xml
+++ b/OsmAnd-telegram/res/values-ru/strings.xml
@@ -63,7 +63,7 @@
     У меня нет учетной записи Telegram
     Введите номер телефона
     Введите код аутентификации
-    Сохранить
+    Добавить
     Назовите новое устройство макс. 200 символов.
     Расстояние
     Моя локация

From 3bc6ec76edd4f3cd116af8003c47d5e8a16d088a Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 16:13:08 +0300
Subject: [PATCH 24/29] Remove default gpx color and width

---
 OsmAnd/res/layout/track_coloring_card.xml     |  1 +
 .../plus/dialogs/GpxAppearanceAdapter.java    | 19 ++++++++-----------
 .../osmand/plus/track/TrackColoringCard.java  | 11 +++++------
 .../net/osmand/plus/track/TrackWidthCard.java | 14 ++++++++++----
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/OsmAnd/res/layout/track_coloring_card.xml b/OsmAnd/res/layout/track_coloring_card.xml
index 5775a98c7d..2c7721f61d 100644
--- a/OsmAnd/res/layout/track_coloring_card.xml
+++ b/OsmAnd/res/layout/track_coloring_card.xml
@@ -21,6 +21,7 @@
 		android:layout_height="wrap_content"
 		android:orientation="horizontal"
 		android:paddingTop="@dimen/context_menu_padding_margin_tiny"
+		android:visibility="gone"
 		android:paddingBottom="@dimen/content_padding">
 
 		
Date: Tue, 15 Sep 2020 12:28:40 +0000
Subject: [PATCH 25/29] Translated using Weblate (Persian)

Currently translated at 97.3% (3392 of 3484 strings)
---
 OsmAnd/res/values-fa/strings.xml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml
index 14fd623bee..4cc7cc83c8 100644
--- a/OsmAnd/res/values-fa/strings.xml
+++ b/OsmAnd/res/values-fa/strings.xml
@@ -3843,4 +3843,23 @@
     یک فایل رد انتخاب کنید تا باز شود.
     تمام
     بَرنویسی رد
+    آهنگ ذخیره شده را باز کنید
+    ذخیره شده
+    لطفا حداقل دو امتیاز اضافه کنید.
+    آماده
+    "به روز شده برنامه یک عملکرد مسیر: اجازه می دهد تا از انواع مختلف پیمایش در هر بخش و گنجاندن مسیرها استفاده کنید
+\n
+\n  • منوی New Appearance برای آهنگ ها، رنگ ، ضخامت ، فلش جهت نمایش ، نمادهای شروع / پایان استفاده می شوئ
+\n
+\n  • بهبود دید نود های دوچرخه.
+\n
+\n  • آهنگ ها اکنون قابل لمس هستند ، دارای منوی زمینه با اطلاعات اولیه هستند.
+\n
+\n  • بهبود الگوریتم های جستجو
+\n
+\n  • گزینه های ردیابی را در پیمایش بهبود بخشید
+\n
+\n  • مشکلات مربوط به واردات / صادرات تنظیمات نمایه برطرف شده است
+\n
+\n"
 
\ No newline at end of file

From f543d40b1a1641a74675085a7cc866f436085823 Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 18:09:50 +0300
Subject: [PATCH 26/29] Fix possible npe

---
 OsmAnd/src/net/osmand/data/FavouritePoint.java     |  2 ++
 .../controllers/FavouritePointMenuController.java  | 14 ++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/OsmAnd/src/net/osmand/data/FavouritePoint.java b/OsmAnd/src/net/osmand/data/FavouritePoint.java
index 72cde20159..e5f4f6c8ea 100644
--- a/OsmAnd/src/net/osmand/data/FavouritePoint.java
+++ b/OsmAnd/src/net/osmand/data/FavouritePoint.java
@@ -7,6 +7,7 @@ import android.graphics.BitmapFactory;
 
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.annotation.StringRes;
 
 import net.osmand.GPXUtilities.WptPt;
@@ -89,6 +90,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
 			return color;
 	}
 
+	@Nullable
 	public String getAddress() {
 		return address;
 	}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
index c1420b7d24..a6a84bee67 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
@@ -28,6 +28,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
 import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew;
 import net.osmand.plus.transport.TransportStopRoute;
 import net.osmand.plus.widgets.style.CustomTypefaceSpan;
+import net.osmand.util.Algorithms;
 import net.osmand.util.OpeningHoursParser;
 import net.osmand.view.GravityDrawable;
 
@@ -160,11 +161,16 @@ public class FavouritePointMenuController extends MenuController {
 	@NonNull
 	@Override
 	public CharSequence getSubtypeStr() {
-		Typeface typeface = FontCache.getRobotoRegular(getMapActivity());
-		SpannableString addressSpannable = new SpannableString(fav.getAddress());
-		addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0);
+		MapActivity mapActivity = getMapActivity();
+		if (mapActivity != null && !Algorithms.isEmpty(fav.getAddress())) {
+			Typeface typeface = FontCache.getRobotoRegular(mapActivity);
+			SpannableString addressSpannable = new SpannableString(fav.getAddress());
+			addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0);
 
-		return addressSpannable;
+			return addressSpannable;
+		} else {
+			return "";
+		}
 	}
 
 	@Override

From 485368d2624677b83bc8f256f234d03f0b365d32 Mon Sep 17 00:00:00 2001
From: max-klaus 
Date: Tue, 15 Sep 2020 18:12:29 +0300
Subject: [PATCH 27/29] Request inventory on start only

---
 OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
index 2fe36e624d..ac7e2c77fb 100644
--- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
+++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
@@ -63,6 +63,7 @@ public class InAppPurchaseHelper {
 
 	private InAppPurchases purchases;
 	private long lastValidationCheckTime;
+	private boolean inventoryRequested;
 
 	private static final long PURCHASE_VALIDATION_PERIOD_MSEC = 1000 * 60 * 60 * 24; // daily
 	// (arbitrary) request code for the purchase flow
@@ -333,8 +334,8 @@ public class InAppPurchaseHelper {
 	}
 
 	public boolean needRequestInventory() {
-		return (isSubscribedToLiveUpdates(ctx) && Algorithms.isEmpty(ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.get()))
-				|| System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC;
+		return !inventoryRequested && ((isSubscribedToLiveUpdates(ctx) && Algorithms.isEmpty(ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.get()))
+				|| System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC);
 	}
 
 	public void requestInventory() {
@@ -803,6 +804,7 @@ public class InAppPurchaseHelper {
 		protected void onPostExecute(String response) {
 			logDebug("Response=" + response);
 			if (response != null) {
+				inventoryRequested = true;
 				try {
 					JSONObject obj = new JSONObject(response);
 					JSONArray names = obj.names();

From 6e856f2ee36aaa13d3da80485e8d41eba0604f17 Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 18:28:03 +0300
Subject: [PATCH 28/29] Fix possible npe in ProfileCard

---
 .../src/net/osmand/plus/measurementtool/ProfileCard.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java b/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
index 98d180e48f..8fc3be3037 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
@@ -8,6 +8,8 @@ import android.widget.LinearLayout;
 import android.widget.RadioButton;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+
 import net.osmand.plus.R;
 import net.osmand.plus.UiUtilities;
 import net.osmand.plus.activities.MapActivity;
@@ -23,7 +25,7 @@ public class ProfileCard extends BaseCard {
 	private ApplicationMode selectedMode;
 	private ProfileCardListener listener;
 
-	public ProfileCard(MapActivity mapActivity, ApplicationMode selectedMode) {
+	public ProfileCard(@NonNull MapActivity mapActivity, @NonNull ApplicationMode selectedMode) {
 		super(mapActivity);
 		this.selectedMode = selectedMode;
 	}
@@ -75,7 +77,10 @@ public class ProfileCard extends BaseCard {
 	}
 
 	private void resetSelected(List modes) {
-		((RadioButton) view.findViewWithTag(selectedMode.getStringKey()).findViewById(R.id.compound_button)).setChecked(true);
+		View profileView = view.findViewWithTag(selectedMode.getStringKey());
+		if (profileView != null) {
+			((RadioButton) profileView.findViewById(R.id.compound_button)).setChecked(true);
+		}
 	}
 
 	private void addProfileView(LinearLayout container, View.OnClickListener onClickListener, Object tag,

From e6ab61c6c8d349d20b1c5b4ebc9c21f58277f11b Mon Sep 17 00:00:00 2001
From: Vitaliy 
Date: Tue, 15 Sep 2020 18:43:42 +0300
Subject: [PATCH 29/29] Fix UnknownFormatConversionException

---
 OsmAnd/res/values-de/strings.xml                          | 2 +-
 .../osmand/plus/search/SendSearchQueryBottomSheet.java    | 8 +-------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index 16672becc8..730f97c489 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -2785,7 +2785,7 @@
     Als Track speichern
     Sie haben %1$s Punkte hinzugefügt. Geben Sie einen Dateinamen ein und klicken Sie auf „Speichern“.
     Punkt %1$s gelöscht
-    Ihre Suchanfrage wird an: \"%1 s\" gesendet, zusammen mit Ihrem Standort.
+    Ihre Suchanfrage wird an: \"%1$s\" gesendet, zusammen mit Ihrem Standort.
 \n
 \nPersönliche Informationen werden nicht gesammelt, sondern nur Suchdaten, die zur Verbesserung der Suche benötigt werden.
     Keine Ergebnisse?
diff --git a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
index a46393fc67..39e91503ec 100644
--- a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
@@ -1,8 +1,6 @@
 package net.osmand.plus.search;
 
-import android.os.Build;
 import android.os.Bundle;
-import android.text.Html;
 import android.view.ContextThemeWrapper;
 import android.view.View;
 import android.widget.TextView;
@@ -50,11 +48,7 @@ public class SendSearchQueryBottomSheet extends MenuBottomSheetDialogFragment {
 		final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
 		final TextView textView = (TextView) View.inflate(new ContextThemeWrapper(getContext(), themeRes),
 				R.layout.send_missing_search_query_tv, null);
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-			textView.setText(getString(R.string.send_search_query_description, searchQuery));
-		} else {
-			textView.setText(getString(R.string.send_search_query_description, searchQuery));
-		}
+		textView.setText(getString(R.string.send_search_query_description, searchQuery));
 		BaseBottomSheetItem sendSearchQueryDescription = new SimpleBottomSheetItem.Builder().setCustomView(textView)
 				.create();
 		items.add(sendSearchQueryDescription);