From 994c9495bad07fd7307ea85986a7766adb15cf84 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 15 Jan 2015 16:17:55 +0100 Subject: [PATCH] added dedicated button to disable foreground service in perma notification --- .../services/NotificationService.java | 11 +++++++++-- src/main/res/drawable-hdpi/ic_action_cancel.png | Bin 0 -> 353 bytes src/main/res/drawable-mdpi/ic_action_cancel.png | Bin 0 -> 272 bytes src/main/res/drawable-xhdpi/ic_action_cancel.png | Bin 0 -> 415 bytes src/main/res/drawable-xxhdpi/ic_action_cancel.png | Bin 0 -> 574 bytes src/main/res/values/strings.xml | 3 ++- 6 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 src/main/res/drawable-hdpi/ic_action_cancel.png create mode 100644 src/main/res/drawable-mdpi/ic_action_cancel.png create mode 100644 src/main/res/drawable-xhdpi/ic_action_cancel.png create mode 100644 src/main/res/drawable-xxhdpi/ic_action_cancel.png diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 6f02fca9c..a32bb2797 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 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 0000000000000000000000000000000000000000..e206f296c2535b11a2243ae93a31b2957f42ab7d GIT binary patch literal 353 zcmV-n0iOPeP)<|{Ln>}1B}pV4FnQGw$lhbcF#pN_|NmTvlOA(yaXHp7=YfQzWd6l13QbWBbF5EntH}^M8nLKhNl}v$ z`vZ-XOPZxe9-MDujuPO_2=wV|3@K%?U6t&_#+%cevc=Z|mdKI;Vst0JaBXn*aa+ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..d1634205dfec57c9ce660a6bd6e9338c4a4a7b86 GIT binary patch literal 415 zcmV;Q0bu@#P)q}AtQYDUDT$39RD*!28&48mq(Bf4M z*efW9cy$A|3d4V1o%z@v+C@zkpMKi=gq( z;I)vA(3}bH@|rvKM#%J5*z{q@^l{j9LBw=P%yd!IbXnZ=#fa&vu^iuQjhHdV;Tpbc z`@Fl|n2Wjr5BGg7jj7@Nn$Qio;4%G+3?YONLI@#*kQ4I~U;up6U|mr}u3rEE002ov JPDHLkV1oU%v4;Qv literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..5dc214356fa92bfe1ed3809118ede20f6f853656 GIT binary patch literal 574 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGok|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+7$11LIEGZ*dNb#3?jZva*W7=b-L@w-lrbK2kZop7XjpfV zGh#9GlD1_*tsx!?-*%f@x^Hq&IP%%{XW!f@Ks%7ZfywJ$n=O^~ik7~*=Uw)_Gm3xC z?~C;KA^b1@Zm8;$Sr4aAzkBug@=Mz+pX*=!aQgJVEz?)8zvq2c-i+xVXMEJ5-Vdw2 zB0^uCf8G23oa`O#+&;FJ`t|-rOxylW($h~&__2JSf7tJagR#a{g zR;!|d;+#c=g+U@&8#qlP?>iTDL8fv<-j3NWs1Dzp&i6b`Uf zX#a4S^$OQ1)f!I5VD@Js`+6EyHWhQndmY%!Xw{~#{@|iQ?BVGm24)xj?M?l$iOJ2& zW8Fh#s{qD=Ojqze(iZm7@2I z%I@218TfOAUI_H-2v0oV{2Mtkfb0dj_nCMYChW}1JZTwX29or2^>bP0l+XkKmnG>o literal 0 HcmV?d00001 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 54ab2c50a..883a41e77 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -357,7 +357,6 @@ Contact requested SMP verification No valid OTR session has been found! Conversations - Touch to disable foreground service Keep service in foreground Prevents the operating system from killing your connection Choose file @@ -441,4 +440,6 @@ video file PDF document Received %s + Disable foreground service + Touch to open Conversations