All notification now have public visibility. Closes #2241

This commit is contained in:
GaidamakUA 2016-02-16 10:34:31 +02:00
parent d621d6e7d3
commit 7e175928c2
5 changed files with 23 additions and 18 deletions

View file

@ -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) {

View file

@ -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()))

View file

@ -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();

View file

@ -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));

View file

@ -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<ApplicationMode> {
@ -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)