From 63817ecda106183026f1f160bc11b73fcbfa8b90 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 11 Sep 2017 09:27:39 +0200 Subject: [PATCH] removed unused 'disable foreground' button --- .../java/eu/siacs/conversations/Config.java | 1 - .../services/NotificationService.java | 19 ------------------- .../services/XmppConnectionService.java | 5 ----- 3 files changed, 25 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index d79683d4..645620a6 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -47,7 +47,6 @@ public final class Config { public static final boolean FORCE_ORBOT = false; // always use TOR public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification - public static final boolean SHOW_DISABLE_FOREGROUND = false; //if set to true the foreground notification has a button to disable it public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false; diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index dc18b74c..2a234d20 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -614,13 +614,6 @@ public class NotificationService { return PendingIntent.getService(mXmppConnectionService, (conversation.getUuid().hashCode() % NOTIFICATION_ID_MULTIPLIER) + 16 * NOTIFICATION_ID_MULTIPLIER, intent, PendingIntent.FLAG_UPDATE_CURRENT); } - private PendingIntent createDisableForeground() { - final Intent intent = new Intent(mXmppConnectionService, - XmppConnectionService.class); - intent.setAction(XmppConnectionService.ACTION_DISABLE_FOREGROUND); - return PendingIntent.getService(mXmppConnectionService, 34, intent, 0); - } - private PendingIntent createTryAgainIntent() { final Intent intent = new Intent(mXmppConnectionService, XmppConnectionService.class); intent.setAction(XmppConnectionService.ACTION_TRY_AGAIN); @@ -701,18 +694,6 @@ public class NotificationService { mBuilder.setWhen(0); mBuilder.setPriority(Config.SHOW_CONNECTED_ACCOUNTS ? NotificationCompat.PRIORITY_DEFAULT : NotificationCompat.PRIORITY_MIN); mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp); - if (Config.SHOW_DISABLE_FOREGROUND) { - final int cancelIcon; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mBuilder.setCategory(Notification.CATEGORY_SERVICE); - cancelIcon = R.drawable.ic_cancel_white_24dp; - } else { - cancelIcon = R.drawable.ic_action_cancel; - } - mBuilder.addAction(cancelIcon, - mXmppConnectionService.getString(R.string.disable_foreground_service), - createDisableForeground()); - } return mBuilder.build(); } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 1259707d..ae138ffb 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -155,7 +155,6 @@ public class XmppConnectionService extends Service { public static final String ACTION_REPLY_TO_CONVERSATION = "reply_to_conversations"; public static final String ACTION_MARK_AS_READ = "mark_as_read"; public static final String ACTION_CLEAR_NOTIFICATION = "clear_notification"; - public static final String ACTION_DISABLE_FOREGROUND = "disable_foreground"; public static final String ACTION_DISMISS_ERROR_NOTIFICATIONS = "dismiss_error"; public static final String ACTION_TRY_AGAIN = "try_again"; public static final String ACTION_IDLE_PING = "idle_ping"; @@ -667,10 +666,6 @@ public class XmppConnectionService extends Service { mNotificationService.clear(); } break; - case ACTION_DISABLE_FOREGROUND: - getPreferences().edit().putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE, false).commit(); - toggleForegroundService(); - break; case ACTION_DISMISS_ERROR_NOTIFICATIONS: dismissErrorNotifications(); break;