diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 0251cf49e1..99f2e9c967 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,6 +11,8 @@
Thx - Hardy
-->
+ Show system notification while navigation with navigation instructions.
+ Navigation notification
Please provide a name for the profile
Open settings
Plugin disabled
diff --git a/OsmAnd/res/xml/navigation_settings_new.xml b/OsmAnd/res/xml/navigation_settings_new.xml
index 50df1cdf35..d01598fd24 100644
--- a/OsmAnd/res/xml/navigation_settings_new.xml
+++ b/OsmAnd/res/xml/navigation_settings_new.xml
@@ -72,4 +72,12 @@
android:summaryOn="@string/shared_string_on"
android:title="@string/animate_my_location" />
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 90049786d8..ea87506c44 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -1973,6 +1973,8 @@ public class OsmandSettings {
SHOW_ZOOM_BUTTONS_NAVIGATION.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
}
+ public final CommonPreference SHOW_NAVIGATION_NOTIFICATION = new BooleanPreference("show_navigation_notification", true).makeProfile();
+
// Json
public final OsmandPreference SELECTED_GPX = new StringPreference("selected_gpx", "").makeGlobal();
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java
index 9216fe9210..9b05493363 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java
@@ -200,7 +200,7 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment
private void setupShowTripRecNotificationPref() {
SwitchPreferenceEx showTripRecNotification = (SwitchPreferenceEx) findPreference(settings.SHOW_TRIP_REC_NOTIFICATION.getId());
- showTripRecNotification.setDescription(getString(R.string.trip_rec_notification_settings));
+ showTripRecNotification.setDescription(getString(R.string.trip_rec_notification_settings_desc));
showTripRecNotification.setIcon(getPersistentPrefIcon(R.drawable.ic_action_notification));
}
diff --git a/OsmAnd/src/net/osmand/plus/notifications/DownloadNotification.java b/OsmAnd/src/net/osmand/plus/notifications/DownloadNotification.java
index 5b1e7109c4..92091f651b 100644
--- a/OsmAnd/src/net/osmand/plus/notifications/DownloadNotification.java
+++ b/OsmAnd/src/net/osmand/plus/notifications/DownloadNotification.java
@@ -53,6 +53,11 @@ public class DownloadNotification extends OsmandNotification {
return new Intent(app, DownloadActivity.class);
}
+ @Override
+ public boolean isUpdateDisabled() {
+ return false;
+ }
+
@Override
public NotificationCompat.Builder buildNotification(boolean wearable) {
icon = android.R.drawable.stat_sys_download;
diff --git a/OsmAnd/src/net/osmand/plus/notifications/ErrorNotification.java b/OsmAnd/src/net/osmand/plus/notifications/ErrorNotification.java
index af9a3841c9..a31d77851b 100644
--- a/OsmAnd/src/net/osmand/plus/notifications/ErrorNotification.java
+++ b/OsmAnd/src/net/osmand/plus/notifications/ErrorNotification.java
@@ -48,6 +48,11 @@ public class ErrorNotification extends OsmandNotification {
return new Intent(app, MapActivity.class);
}
+ @Override
+ public boolean isUpdateDisabled() {
+ return false;
+ }
+
@Override
public NotificationCompat.Builder buildNotification(boolean wearable) {
String notificationTitle;
diff --git a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java
index c56b92027b..647f8e0aec 100644
--- a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java
+++ b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java
@@ -103,6 +103,11 @@ public class GpxNotification extends OsmandNotification {
return new Intent(app, MapActivity.class);
}
+ @Override
+ public boolean isUpdateDisabled() {
+ return app.getSettings().MAP_ACTIVITY_ENABLED.get() && !app.getSettings().SHOW_TRIP_REC_NOTIFICATION.get();
+ }
+
@Override
public void onNotificationDismissed() {
if (!wasNoDataDismissed) {
@@ -122,7 +127,7 @@ public class GpxNotification extends OsmandNotification {
boolean isGpxRecording = app.getSavingTrackHelper().getIsRecording();
float recordedDistance = app.getSavingTrackHelper().getDistance();
ongoing = true;
- lastBuiltNoData = false;
+ lastBuiltNoData = false;
if (isGpxRecording) {
color = app.getResources().getColor(R.color.osmand_orange);
notificationTitle = app.getString(R.string.shared_string_trip) + " • "
diff --git a/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java b/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java
index 82bc936d22..47e7849316 100644
--- a/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java
+++ b/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java
@@ -114,6 +114,11 @@ public class NavigationNotification extends OsmandNotification {
|| (routingHelper.isRoutePlanningMode() && routingHelper.isPauseNavigation());
}
+ @Override
+ public boolean isUpdateDisabled() {
+ return app.getSettings().MAP_ACTIVITY_ENABLED.get() && !app.getSettings().SHOW_NAVIGATION_NOTIFICATION.get();
+ }
+
@Override
public Intent getContentIntent() {
return new Intent(app, MapActivity.class);
diff --git a/OsmAnd/src/net/osmand/plus/notifications/OsmandNotification.java b/OsmAnd/src/net/osmand/plus/notifications/OsmandNotification.java
index 30ed6236ed..6e24cc370c 100644
--- a/OsmAnd/src/net/osmand/plus/notifications/OsmandNotification.java
+++ b/OsmAnd/src/net/osmand/plus/notifications/OsmandNotification.java
@@ -11,7 +11,6 @@ import android.support.v4.app.NotificationManagerCompat;
import net.osmand.plus.NotificationHelper;
import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.activities.MapActivity;
public abstract class OsmandNotification {
@@ -105,6 +104,8 @@ public abstract class OsmandNotification {
public abstract boolean isEnabled();
+ public abstract boolean isUpdateDisabled();
+
public abstract Intent getContentIntent();
public void setupNotification(Notification notification) {
@@ -125,7 +126,7 @@ public abstract class OsmandNotification {
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(app);
if (isEnabled()) {
Builder notificationBuilder = buildNotification(false);
- if (notificationBuilder != null) {
+ if (notificationBuilder != null && !isUpdateDisabled()) {
Notification notification = getNotification(notificationBuilder, false);
setupNotification(notification);
notificationManager.notify(top ? TOP_NOTIFICATION_SERVICE_ID : getOsmandNotificationId(), notification);
@@ -141,6 +142,9 @@ public abstract class OsmandNotification {
if (isEnabled()) {
Builder notificationBuilder = buildNotification(false);
if (notificationBuilder != null) {
+ if (isUpdateDisabled()) {
+ return false;
+ }
Notification notification = getNotification(notificationBuilder, true);
setupNotification(notification);
if (top) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java b/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java
index ba7b3ab808..296f6c8319 100644
--- a/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java
@@ -63,6 +63,7 @@ public class NavigationFragment extends BaseSettingsFragment {
setupSpeakRoutingAlarmsPref();
setupVehicleParametersPref();
+ setupNavigationNotificationPref();
animateMyLocation.setDescription(getString(R.string.animate_my_location_desc));
}
@@ -260,6 +261,12 @@ public class NavigationFragment extends BaseSettingsFragment {
vehicleParameters.setIcon(getContentIcon(iconRes));
}
+ private void setupNavigationNotificationPref() {
+ SwitchPreferenceEx navigationNotification = (SwitchPreferenceEx) findPreference(settings.SHOW_NAVIGATION_NOTIFICATION.getId());
+ navigationNotification.setDescription(getString(R.string.navigation_notification_desc));
+ navigationNotification.setIcon(getPersistentPrefIcon(R.drawable.ic_action_notification));
+ }
+
private void updateMenu() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {