aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/NotificationService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/NotificationService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 2ea0904f..203cda49 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -41,6 +41,7 @@ import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.ui.ManageAccountActivity;
import eu.siacs.conversations.ui.TimePreference;
import eu.siacs.conversations.utils.UIHelper;
+import eu.siacs.conversations.xmpp.XmppConnection;
public class NotificationService {
@@ -395,7 +396,20 @@ public class NotificationService {
final Intent intent = new Intent(mXmppConnectionService,
XmppConnectionService.class);
intent.setAction(XmppConnectionService.ACTION_DISABLE_FOREGROUND);
- return PendingIntent.getService(mXmppConnectionService, 0, intent, 0);
+ return PendingIntent.getService(mXmppConnectionService, 34, intent, 0);
+ }
+
+ private PendingIntent createTryAgainIntent() {
+ final Intent intent = new Intent(mXmppConnectionService, XmppConnectionService.class);
+ intent.setAction(XmppConnectionService.ACTION_TRY_AGAIN);
+ return PendingIntent.getService(mXmppConnectionService, 45, intent, 0);
+ }
+
+ private PendingIntent createDisableAccountIntent(final Account account) {
+ final Intent intent = new Intent(mXmppConnectionService,XmppConnectionService.class);
+ intent.setAction(XmppConnectionService.ACTION_DISABLE_ACCOUNT);
+ intent.putExtra("account",account.getJid().toBareJid().toString());
+ return PendingIntent.getService(mXmppConnectionService,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
}
private boolean wasHighlightedOrPrivate(final Message message) {
@@ -492,6 +506,14 @@ public class NotificationService {
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.problem_connecting_to_accounts));
mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_fix));
}
+ mBuilder.addAction(R.drawable.ic_autorenew_white_24dp,
+ mXmppConnectionService.getString(R.string.try_again),
+ createTryAgainIntent());
+ if (errors.size() == 1) {
+ mBuilder.addAction(R.drawable.ic_block_white_24dp,
+ mXmppConnectionService.getString(R.string.disable_account),
+ createDisableAccountIntent(errors.get(0)));
+ }
mBuilder.setOngoing(true);
//mBuilder.setLights(0xffffffff, 2000, 4000);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {