Commit d69a444f authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Do not show a badge for the DNS notification

parent 6e96d027
package com.frostnerd.dnschanger.services;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
......@@ -8,6 +9,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.VpnService;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
......@@ -171,8 +173,12 @@ public class DNSVpnService extends VpnService {
notificationBuilder.setAutoCancel(false);
notificationBuilder.setOngoing(true);
notificationBuilder.setUsesChronometer(true);
notificationBuilder.addAction(new android.support.v4.app.NotificationCompat.Action(R.drawable.ic_stat_pause, getString(R.string.action_pause),null));
notificationBuilder.addAction(new android.support.v4.app.NotificationCompat.Action(R.drawable.ic_stat_stop, getString(R.string.action_stop),null));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationBuilder.setBadgeIconType(Notification.BADGE_ICON_NONE);
}
notificationBuilder.setPriority(NotificationCompat.PRIORITY_MIN);
notificationBuilder.addAction(new NotificationCompat.Action(R.drawable.ic_stat_pause, getString(R.string.action_pause),null));
notificationBuilder.addAction(new NotificationCompat.Action(R.drawable.ic_stat_stop, getString(R.string.action_stop),null));
notificationBuilder.setColorized(false);
LogFactory.writeMessage(this, new String[]{LOG_TAG, "[NOTIFICATION]"}, "Notification created (Not yet posted)");
}
......
......@@ -231,10 +231,11 @@ public final class Util {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager notificationManager = Utils.requireNonNull((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE));
if(allowHiding && PreferencesAccessor.shouldHideNotificationIcon(context)){
NotificationChannel channel = new NotificationChannel("noIconChannel", context.getString(R.string.notification_channel_hiddenicon), NotificationManager.IMPORTANCE_NONE);
NotificationChannel channel = new NotificationChannel("noIconChannel", context.getString(R.string.notification_channel_hiddenicon), NotificationManager.IMPORTANCE_MIN);
channel.enableLights(false);
channel.enableVibration(false);
channel.setDescription(context.getString(R.string.notification_channel_hiddenicon_description));
channel.setImportance(NotificationManager.IMPORTANCE_MIN);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
notificationManager.createNotificationChannel(channel);
return "noIconChannel";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment