From cc99ecbbc5f4c49c1b34faf06497545e0b25d762 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 23 Feb 2018 15:46:54 +0200 Subject: [PATCH 01/13] added type of map to the contentText in downloading notification --- OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 16b6100792..2403392111 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -124,6 +124,7 @@ public class DownloadIndexesThread { contentText.append(", "); } contentText.append(i.getVisibleName(app, app.getRegions())); + contentText.append(" ").append(i.getType().getString(app)); } bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) From 05b48e899d119315f2e44c6c52f4de7a22676e81 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 23 Feb 2018 16:58:56 +0200 Subject: [PATCH 02/13] added type of map to the ContentTitle in downloading notification --- OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 2403392111..65beecac88 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -126,7 +126,7 @@ public class DownloadIndexesThread { contentText.append(i.getVisibleName(app, app.getRegions())); contentText.append(" ").append(i.getType().getString(app)); } - bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) + bld.setContentTitle(msg+" "+currentDownloadingItem.getType().getString(app)).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentText(contentText.toString()) .setContentIntent(contentPendingIntent).setOngoing(true); From f29ace45444cbd6ffd938b37937133fdd8eb5593 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 23 Feb 2018 18:03:47 +0200 Subject: [PATCH 03/13] fixed nullPointerException and removed current downloading text from contentText --- .../plus/download/DownloadIndexesThread.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 65beecac88..b2c7dc3038 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -119,14 +119,22 @@ public class DownloadIndexesThread { } StringBuilder contentText = new StringBuilder(); List ii = getCurrentDownloadingItems(); - for(IndexItem i : ii) { - if(contentText.length() > 0) { + for (IndexItem i : ii) { + if (contentText.length() > 0) { contentText.append(", "); } + if (i == currentDownloadingItem) { + continue; + } contentText.append(i.getVisibleName(app, app.getRegions())); - contentText.append(" ").append(i.getType().getString(app)); + if (i.getType() != null) { + contentText.append(" ").append(i.getType().getString(app)); + } } - bld.setContentTitle(msg+" "+currentDownloadingItem.getType().getString(app)).setSmallIcon(android.R.drawable.stat_sys_download) + if (currentDownloadingItem != null) { + msg += " " + currentDownloadingItem.getType().getString(app); + } + bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentText(contentText.toString()) .setContentIntent(contentPendingIntent).setOngoing(true); From 64cfd1d4b5f8ed16c3dcea5bf796ad51545f7892 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 23 Feb 2018 19:06:24 +0200 Subject: [PATCH 04/13] added ":" to downloading title in notification --- OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index dd77eea2be..3ab055a453 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -262,7 +262,7 @@ public class DownloadFileHelper { if(mb == 0) { mb = 1; } - String taskName = ctx.getString(R.string.shared_string_downloading) + " " + + String taskName = ctx.getString(R.string.shared_string_downloading) + ": " + //+ de.baseName /*+ " " + mb + " MB"*/; FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName); From 0d03a7d472cea1c3e6e1e32085cd3bc31f66f685 Mon Sep 17 00:00:00 2001 From: Chumva Date: Mon, 26 Feb 2018 13:33:51 +0200 Subject: [PATCH 05/13] moved check for if currentDownloadingItem tp the top --- .../src/net/osmand/plus/download/DownloadIndexesThread.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index b2c7dc3038..a98acbe0c0 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -120,12 +120,12 @@ public class DownloadIndexesThread { StringBuilder contentText = new StringBuilder(); List ii = getCurrentDownloadingItems(); for (IndexItem i : ii) { - if (contentText.length() > 0) { - contentText.append(", "); - } if (i == currentDownloadingItem) { continue; } + if (contentText.length() > 0) { + contentText.append(", "); + } contentText.append(i.getVisibleName(app, app.getRegions())); if (i.getType() != null) { contentText.append(" ").append(i.getType().getString(app)); From fdd75a211d8221332e5fb7edada0c7ec2c33c464 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 11:31:26 +0200 Subject: [PATCH 06/13] added type of downloading map to taskName --- OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java | 4 ++++ OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java | 2 +- .../src/net/osmand/plus/download/DownloadIndexesThread.java | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java b/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java index 6eac51c0e6..6e1afeccb3 100644 --- a/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java @@ -127,4 +127,8 @@ public abstract class BasicProgressAsyncTask exte protected void setTag(Tag tag) { this.tag = tag; } + + public Tag getTag() { + return tag; + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index 3ab055a453..b92d662c5b 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -264,7 +264,7 @@ public class DownloadFileHelper { } String taskName = ctx.getString(R.string.shared_string_downloading) + ": " + //+ de.baseName /*+ " " + mb + " MB"*/; - FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName); + FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName) + " " + de.type.getString(ctx); progress.startTask(taskName, len / 1024); if (!de.zipStream) { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index a98acbe0c0..343c164f3c 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -120,7 +120,7 @@ public class DownloadIndexesThread { StringBuilder contentText = new StringBuilder(); List ii = getCurrentDownloadingItems(); for (IndexItem i : ii) { - if (i == currentDownloadingItem) { + if (!isFinished && task.getTag() == i) { continue; } if (contentText.length() > 0) { @@ -131,9 +131,6 @@ public class DownloadIndexesThread { contentText.append(" ").append(i.getType().getString(app)); } } - if (currentDownloadingItem != null) { - msg += " " + currentDownloadingItem.getType().getString(app); - } bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentText(contentText.toString()) From 06626ed49fee7b9d6ecbcf66ae7a80384ea7b7bb Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 12:02:59 +0200 Subject: [PATCH 07/13] added stringBuilder for creating taskName and check for null --- .../net/osmand/plus/download/DownloadFileHelper.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index b92d662c5b..aca4fe61a4 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -262,11 +262,14 @@ public class DownloadFileHelper { if(mb == 0) { mb = 1; } - String taskName = ctx.getString(R.string.shared_string_downloading) + ": " + + StringBuilder taskName = new StringBuilder(); + taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": "); //+ de.baseName /*+ " " + mb + " MB"*/; - FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName) + " " + de.type.getString(ctx); - - progress.startTask(taskName, len / 1024); + taskName.append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); + if (de.type != null && de.type.getString(ctx) != null) { + taskName.append(" ").append(de.type.getString(ctx)); + } + progress.startTask(taskName.toString(), len / 1024); if (!de.zipStream) { copyFile(de, progress, fin, len, fin, de.fileToDownload); } else if(de.urlToDownload.contains(".gz")) { From 734dcf9379f7dec094c4677c62fc9293a9eea873 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 12:06:11 +0200 Subject: [PATCH 08/13] refactored some code in creating taskName --- OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index aca4fe61a4..b41efbaa80 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -263,9 +263,9 @@ public class DownloadFileHelper { mb = 1; } StringBuilder taskName = new StringBuilder(); - taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": "); - //+ de.baseName /*+ " " + mb + " MB"*/; - taskName.append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); + taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": ") + /*+ de.baseName + " " + mb + " MB"*/ + .append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); if (de.type != null && de.type.getString(ctx) != null) { taskName.append(" ").append(de.type.getString(ctx)); } From b29012009ea6e39120cf8aea4bbb3a18815de0d2 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 12:19:46 +0200 Subject: [PATCH 09/13] refactored some code in creating taskName --- OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index b41efbaa80..aca4fe61a4 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -263,9 +263,9 @@ public class DownloadFileHelper { mb = 1; } StringBuilder taskName = new StringBuilder(); - taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": ") - /*+ de.baseName + " " + mb + " MB"*/ - .append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); + taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": "); + //+ de.baseName /*+ " " + mb + " MB"*/; + taskName.append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); if (de.type != null && de.type.getString(ctx) != null) { taskName.append(" ").append(de.type.getString(ctx)); } From 5c80c1c791fd83347e657a49aed0cd80fec8a1da Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 13:18:53 +0200 Subject: [PATCH 10/13] refactored some code --- OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java | 2 +- .../src/net/osmand/plus/download/DownloadIndexesThread.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index aca4fe61a4..fc4b902b9c 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -266,7 +266,7 @@ public class DownloadFileHelper { taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": "); //+ de.baseName /*+ " " + mb + " MB"*/; taskName.append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName)); - if (de.type != null && de.type.getString(ctx) != null) { + if (de.type != null) { taskName.append(" ").append(de.type.getString(ctx)); } progress.startTask(taskName.toString(), len / 1024); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 343c164f3c..9e2ee43435 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -127,9 +127,7 @@ public class DownloadIndexesThread { contentText.append(", "); } contentText.append(i.getVisibleName(app, app.getRegions())); - if (i.getType() != null) { - contentText.append(" ").append(i.getType().getString(app)); - } + contentText.append(" ").append(i.getType().getString(app)); } bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) From 5197998c7e965ea01d1c5315e53061053c6a6ab7 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 15:44:44 +0200 Subject: [PATCH 11/13] added check for elevation --- .../osmand/plus/measurementtool/MeasurementEditingContext.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 95559ba6ef..34dd0b1e5a 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -309,6 +309,9 @@ public class MeasurementEditingContext { public void onRouteCalculated(List locations) { ArrayList pts = new ArrayList<>(locations.size()); for (Location loc : locations) { + if(!loc.hasAltitude()){ + continue; + } WptPt pt = new WptPt(); pt.lat = loc.getLatitude(); pt.lon = loc.getLongitude(); From 2562ef6337942f20b52a87b5e623b9a67fcf77e7 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 17:27:40 +0200 Subject: [PATCH 12/13] fixed bug in parking context menu --- .../src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index f45d8b0040..04dd8ce21d 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -288,6 +288,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { if (parkingLayer != null) { MapContextMenu menu = mapActivity.getContextMenu(); if (menu.isVisible()) { + menu.hide(false); menu.show(new LatLon(parkingPosition.getLatitude(), parkingPosition.getLongitude()), parkingLayer.getObjectName(parkingPosition), parkingPosition); } From 164ccc0dbf777b84f8ad582c4499796b4cf2a167 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 27 Feb 2018 17:44:59 +0200 Subject: [PATCH 13/13] added removing animation after choosing "Time-unlimited" --- .../osmand/plus/parkingpoint/ParkingPositionPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 04dd8ce21d..01b93c7756 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -268,7 +268,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { } addOrRemoveParkingEvent(false); setParkingPosition(mapActivity, latitude, longitude, false); - showContextMenuIfNeeded(mapActivity); + showContextMenuIfNeeded(mapActivity,true); mapActivity.getMapView().refreshMap(); } else if (index == 2) { if (wasEventPreviouslyAdded) { @@ -284,11 +284,11 @@ public class ParkingPositionPlugin extends OsmandPlugin { builder.create().show(); } - private void showContextMenuIfNeeded(final MapActivity mapActivity) { + private void showContextMenuIfNeeded(final MapActivity mapActivity, boolean animated) { if (parkingLayer != null) { MapContextMenu menu = mapActivity.getContextMenu(); if (menu.isVisible()) { - menu.hide(false); + menu.hide(animated); menu.show(new LatLon(parkingPosition.getLatitude(), parkingPosition.getLongitude()), parkingLayer.getObjectName(parkingPosition), parkingPosition); } @@ -389,7 +389,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { } else { addOrRemoveParkingEvent(false); } - showContextMenuIfNeeded(mapActivity); + showContextMenuIfNeeded(mapActivity,false); } }); setTime.create();