From 7e175928c297abeedd9b9375b2ddb26a229d7c84 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 16 Feb 2016 10:34:31 +0200 Subject: [PATCH] All notification now have public visibility. Closes #2241 --- .../net/osmand/plus/NotificationHelper.java | 6 +++-- .../osmand/plus/activities/MapActivity.java | 2 +- .../plus/download/DownloadIndexesThread.java | 7 +++--- .../src/net/osmand/plus/osmo/OsMoService.java | 1 + .../voice/AbstractPrologCommandPlayer.java | 25 ++++++++++--------- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/NotificationHelper.java b/OsmAnd/src/net/osmand/plus/NotificationHelper.java index 14834b3305..44ca7105c6 100644 --- a/OsmAnd/src/net/osmand/plus/NotificationHelper.java +++ b/OsmAnd/src/net/osmand/plus/NotificationHelper.java @@ -1,7 +1,5 @@ package net.osmand.plus; -import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; @@ -11,6 +9,9 @@ import android.content.IntentFilter; import android.support.v4.app.NotificationCompat.Builder; import android.support.v7.app.NotificationCompat; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; + public class NotificationHelper { public final static int NOTIFICATION_SERVICE_ID = 5; public final static String OSMAND_STOP_SERVICE_ACTION = "OSMAND_STOP_SERVICE_ACTION"; //$NON-NLS-1$ @@ -116,6 +117,7 @@ public class NotificationHelper { PendingIntent.FLAG_UPDATE_CURRENT); final Builder notificationBuilder = new NotificationCompat.Builder(app) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentTitle(Version.getAppName(app)).setContentText(notificationText).setSmallIcon(icon) .setContentIntent(contentPendingIntent).setOngoing(service != null); if (monitoringPlugin != null) { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 40390a0270..9d153c1058 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -54,7 +54,6 @@ import net.osmand.plus.AppInitializer.InitEvents; import net.osmand.plus.ApplicationMode; import net.osmand.plus.BusyIndicator; import net.osmand.plus.FirstUsageFragment; -import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener; import net.osmand.plus.OsmAndConstants; @@ -167,6 +166,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents, // pi); int smallIcon = app.getSettings().getApplicationMode().getSmallIconDark(); final Builder noti = new NotificationCompat.Builder(this).setContentTitle(Version.getAppName(app)) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentText(getString(R.string.go_back_to_osmand)) .setSmallIcon(smallIcon) // .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext())) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 7599a531af..d88c16036e 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -124,9 +124,10 @@ public class DownloadIndexesThread { } contentText.append(i.getVisibleName(app, app.getRegions())); } - bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download). - setContentText(contentText.toString()). - setContentIntent(contentPendingIntent).setOngoing(true); + bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + .setContentText(contentText.toString()) + .setContentIntent(contentPendingIntent).setOngoing(true); int progress = getCurrentDownloadingItemProgress(); bld.setProgress(100, Math.max(progress, 0), progress < 0); notification = bld.build(); diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java index 2bda34ad49..1599e1bba5 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java @@ -371,6 +371,7 @@ public class OsMoService implements OsMoReactor { PendingIntent intent = PendingIntent.getBroadcast(app, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); android.support.v4.app.NotificationCompat.Builder bld = new NotificationCompat.Builder(app); + bld.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); bld.setContentInfo(app.getString(R.string.osmo_auth_error, error)); bld.setContentIntent(intent); bld.setContentTitle(app.getString(R.string.osmo_auth_error_short)); diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index 95c9c23af9..1e8612be2b 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -1,14 +1,8 @@ package net.osmand.plus.voice; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; +import android.content.Context; +import android.support.v4.app.NotificationCompat; +import android.support.v4.app.NotificationManagerCompat; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; @@ -22,6 +16,15 @@ import net.osmand.plus.api.AudioFocusHelper; import org.apache.commons.logging.Log; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + import alice.tuprolog.InvalidLibraryException; import alice.tuprolog.InvalidTheoryException; import alice.tuprolog.NoSolutionException; @@ -32,9 +35,6 @@ import alice.tuprolog.Struct; import alice.tuprolog.Term; import alice.tuprolog.Theory; import alice.tuprolog.Var; -import android.content.Context; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; public abstract class AbstractPrologCommandPlayer implements CommandPlayer, StateChangedListener { @@ -103,6 +103,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat int notificationId = 1; NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(ctx) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setSmallIcon(R.drawable.icon) .setContentTitle(ctx.getString(R.string.app_name)) .setContentText(message)