aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-15 16:17:55 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-15 16:17:55 +0100
commit994c9495bad07fd7307ea85986a7766adb15cf84 (patch)
treed570f49ce214b4d2776265c246ec781a9b1d8719 /src
parent351e5d70652ccbb23bbd29ea75b1452f4fa8969e (diff)
added dedicated button to disable foreground service in perma notification
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java11
-rw-r--r--src/main/res/drawable-hdpi/ic_action_cancel.pngbin0 -> 353 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_action_cancel.pngbin0 -> 272 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_action_cancel.pngbin0 -> 415 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_action_cancel.pngbin0 -> 574 bytes
-rw-r--r--src/main/res/values/strings.xml3
6 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 6f02fca9..a32bb279 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -409,13 +409,20 @@ public class NotificationService {
final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
mBuilder.setSmallIcon(R.drawable.ic_stat_communication_import_export);
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service));
- mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_disable));
- mBuilder.setContentIntent(createDisableForeground());
+ mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations));
+ mBuilder.addAction(R.drawable.ic_action_cancel,
+ mXmppConnectionService.getString(R.string.disable_foreground_service),
+ createDisableForeground());
+ mBuilder.setContentIntent(createOpenConversationsIntent());
mBuilder.setWhen(0);
mBuilder.setPriority(NotificationCompat.PRIORITY_MIN);
return mBuilder.build();
}
+ private PendingIntent createOpenConversationsIntent() {
+ return PendingIntent.getActivity(mXmppConnectionService, 0, new Intent(mXmppConnectionService,ConversationActivity.class),0);
+ }
+
public void updateErrorNotification() {
final NotificationManager mNotificationManager = (NotificationManager) mXmppConnectionService.getSystemService(Context.NOTIFICATION_SERVICE);
final List<Account> errors = new ArrayList<>();
diff --git a/src/main/res/drawable-hdpi/ic_action_cancel.png b/src/main/res/drawable-hdpi/ic_action_cancel.png
new file mode 100644
index 00000000..e206f296
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_action_cancel.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_action_cancel.png b/src/main/res/drawable-mdpi/ic_action_cancel.png
new file mode 100644
index 00000000..70e6d2d2
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_action_cancel.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_action_cancel.png b/src/main/res/drawable-xhdpi/ic_action_cancel.png
new file mode 100644
index 00000000..d1634205
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_action_cancel.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_action_cancel.png b/src/main/res/drawable-xxhdpi/ic_action_cancel.png
new file mode 100644
index 00000000..5dc21435
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_action_cancel.png
Binary files differ
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 54ab2c50..883a41e7 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -357,7 +357,6 @@
<string name="smp_requested">Contact requested SMP verification</string>
<string name="no_otr_session_found">No valid OTR session has been found!</string>
<string name="conversations_foreground_service">Conversations</string>
- <string name="touch_to_disable">Touch to disable foreground service</string>
<string name="pref_keep_foreground_service">Keep service in foreground</string>
<string name="pref_keep_foreground_service_summary">Prevents the operating system from killing your connection</string>
<string name="choose_file">Choose file</string>
@@ -441,4 +440,6 @@
<string name="video">video file</string>
<string name="pdf_document">PDF document</string>
<string name="received_x_file">Received %s</string>
+ <string name="disable_foreground_service">Disable foreground service</string>
+ <string name="touch_to_open_conversations">Touch to open Conversations</string>
</resources>