From 6b0083c8ae2e53321f7712cd292379b66a150805 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Mon, 2 Sep 2024 16:27:48 +0000 Subject: [PATCH 1/3] Translated using Weblate (Ukrainian) Currently translated at 100.0% (4873 of 4873 strings) --- OsmAnd/res/values-uk/phrases.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-uk/phrases.xml b/OsmAnd/res/values-uk/phrases.xml index 084e667f315..bb303ee4071 100644 --- a/OsmAnd/res/values-uk/phrases.xml +++ b/OsmAnd/res/values-uk/phrases.xml @@ -4751,12 +4751,12 @@ Доступ: невідомо Доступ: закрито Прочісування пляжу - Велосипедна прогулянка + Велопрогулянка Полювання на велику дичину - Моторне катання на човнах + Катання на моторизованих човнах Оренда кабіни Так - Безмоторне катання на човнах + Катання на немоторизованих човнах Кемпінг в наметовому містечку Через Зони інтерпретації From 707709190127fe8863b280a2463ce8f0fbf66a08 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Mon, 2 Sep 2024 16:31:10 +0000 Subject: [PATCH 2/3] Translated using Weblate (Ukrainian) Currently translated at 100.0% (4873 of 4873 strings) --- OsmAnd/res/values-uk/phrases.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-uk/phrases.xml b/OsmAnd/res/values-uk/phrases.xml index bb303ee4071..44351687f42 100644 --- a/OsmAnd/res/values-uk/phrases.xml +++ b/OsmAnd/res/values-uk/phrases.xml @@ -4734,7 +4734,7 @@ Резервування Облаштування зони відпочинку Фотокабінка - Рюкзак для подорожей + Туристичний похід Зона PAD-US Категорія: проголошення Категорія: плата From 5f6335ac2386db5369cecd5bfb6d0a4000ff6c83 Mon Sep 17 00:00:00 2001 From: alex-osm Date: Mon, 2 Sep 2024 20:46:46 +0300 Subject: [PATCH 3/3] Fix top notifications at startup --- .../net/osmand/plus/NavigationService.java | 4 +- .../notifications/NotificationHelper.java | 61 ++++++++++++------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/NavigationService.java b/OsmAnd/src/net/osmand/plus/NavigationService.java index 0982921a605..d83180dd733 100644 --- a/OsmAnd/src/net/osmand/plus/NavigationService.java +++ b/OsmAnd/src/net/osmand/plus/NavigationService.java @@ -23,6 +23,7 @@ import net.osmand.plus.auto.NavigationSession; import net.osmand.plus.helpers.LocationCallback; import net.osmand.plus.helpers.LocationServiceHelper; +import net.osmand.plus.notifications.OsmandNotification.NotificationType; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.enums.LocationSource; @@ -137,7 +138,8 @@ public int onStartCommand(Intent intent, int flags, int startId) { locationServiceHelper = app.createLocationServiceHelper(); app.setNavigationService(this); - Notification notification = app.getNotificationHelper().buildTopNotification(this); + Notification notification = app.getNotificationHelper().buildTopNotification(this, + isUsedBy(USED_BY_NAVIGATION) ? NotificationType.NAVIGATION : NotificationType.GPX); boolean hasNotification = notification != null; if (hasNotification) { try { diff --git a/OsmAnd/src/net/osmand/plus/notifications/NotificationHelper.java b/OsmAnd/src/net/osmand/plus/notifications/NotificationHelper.java index 57a591c77d6..5b3476d8ed0 100644 --- a/OsmAnd/src/net/osmand/plus/notifications/NotificationHelper.java +++ b/OsmAnd/src/net/osmand/plus/notifications/NotificationHelper.java @@ -52,20 +52,36 @@ private void init() { } @Nullable - public Notification buildTopNotification(@NonNull Service service) { - OsmandNotification notification = acquireTopNotification(service); - if (notification != null) { - removeNotification(notification.getType()); - setTopNotification(notification); - Builder notificationBuilder = notification.buildNotification(service, false); - if (notificationBuilder != null) { - return notificationBuilder.build(); - } else { - return null; + public Notification buildTopNotification(@NonNull Service service, @NonNull NotificationType type) { + List notifications = acquireTopNotifications(service); + for (OsmandNotification notification : notifications) { + if (notification.getType() == type) { + Notification topNotification = buildTopNotification(service, notification); + if (topNotification != null) { + return topNotification; + } } - } else { - return null; } + for (OsmandNotification notification : notifications) { + if (notification.getType() != type) { + Notification topNotification = buildTopNotification(service, notification); + if (topNotification != null) { + return topNotification; + } + } + } + return null; + } + + @Nullable + private Notification buildTopNotification(@NonNull Service service, @NonNull OsmandNotification notification) { + removeNotification(notification.getType()); + setTopNotification(notification); + Builder notificationBuilder = notification.buildNotification(service, false); + if (notificationBuilder != null) { + return notificationBuilder.build(); + } + return null; } @NonNull @@ -78,15 +94,16 @@ public Notification buildCarAppNotification() { return carAppNotification.buildNotification(null, false).build(); } - @Nullable - private OsmandNotification acquireTopNotification(@Nullable Service service) { + @NonNull + private List acquireTopNotifications(@Nullable Service service) { + List res = new ArrayList<>(); if (navigationNotification.isEnabled(service)) { - return navigationNotification; - } else if (gpxNotification.isEnabled(service)) { - return gpxNotification; - } else { - return null; + res.add(navigationNotification); } + if (gpxNotification.isEnabled(service)) { + res.add(gpxNotification); + } + return res; } public void resetTopNotification() { @@ -96,8 +113,10 @@ public void resetTopNotification() { } public void updateTopNotification() { - OsmandNotification notification = acquireTopNotification(null); - setTopNotification(notification); + List notifications = acquireTopNotifications(null); + if (!notifications.isEmpty()) { + setTopNotification(notifications.get(0)); + } } private void setTopNotification(OsmandNotification notification) {