aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services/NotificationService.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-17 11:01:38 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-17 11:01:38 +0200
commit3372e50155ac16c9eabce9a484914c2acbf391c8 (patch)
treead00d1e203d0adf56f27a44cd4a9e12301ac41dc /src/eu/siacs/conversations/services/NotificationService.java
parent5e3caf962696d3fe39e7ce70274530aa4f77d134 (diff)
made grace period on a per account basis
Diffstat (limited to 'src/eu/siacs/conversations/services/NotificationService.java')
-rw-r--r--src/eu/siacs/conversations/services/NotificationService.java25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/eu/siacs/conversations/services/NotificationService.java b/src/eu/siacs/conversations/services/NotificationService.java
index e65085fb..1983e581 100644
--- a/src/eu/siacs/conversations/services/NotificationService.java
+++ b/src/eu/siacs/conversations/services/NotificationService.java
@@ -20,6 +20,7 @@ import android.text.Html;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.ui.ConversationActivity;
@@ -34,9 +35,7 @@ public class NotificationService {
public int NOTIFICATION_ID = 0x2342;
private Conversation mOpenConversation;
private boolean mIsInForeground;
-
- private long mEndGracePeriod = 0L;
-
+
public NotificationService(XmppConnectionService service) {
this.mXmppConnectionService = service;
this.mNotificationManager = (NotificationManager) service
@@ -62,8 +61,9 @@ public class NotificationService {
notifications.put(conversationUuid, mList);
}
}
+ Account account = message.getConversation().getAccount();
updateNotification((!(this.mIsInForeground && this.mOpenConversation == null) || !isScreenOn)
- && !inGracePeriod());
+ && !account.inGracePeriod());
}
public void clear() {
@@ -170,9 +170,7 @@ public class NotificationService {
}
}
mBuilder.setDeleteIntent(createDeleteIntent());
- if (!inGracePeriod()) {
- mBuilder.setLights(0xffffffff, 2000, 4000);
- }
+ mBuilder.setLights(0xffffffff, 2000, 4000);
Notification notification = mBuilder.build();
mNotificationManager.notify(NOTIFICATION_ID, notification);
}
@@ -231,17 +229,4 @@ public class NotificationService {
public void setIsInForeground(boolean foreground) {
this.mIsInForeground = foreground;
}
-
- public void activateGracePeriod() {
- this.mEndGracePeriod = SystemClock.elapsedRealtime()
- + (Config.CARBON_GRACE_PERIOD * 1000);
- }
-
- public void deactivateGracePeriod() {
- this.mEndGracePeriod = 0L;
- }
-
- private boolean inGracePeriod() {
- return SystemClock.elapsedRealtime() < this.mEndGracePeriod;
- }
}