aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services/NotificationService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/services/NotificationService.java')
-rw-r--r--src/eu/siacs/conversations/services/NotificationService.java27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/eu/siacs/conversations/services/NotificationService.java b/src/eu/siacs/conversations/services/NotificationService.java
index e65085fb..0b30e58e 100644
--- a/src/eu/siacs/conversations/services/NotificationService.java
+++ b/src/eu/siacs/conversations/services/NotificationService.java
@@ -13,13 +13,12 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.PowerManager;
-import android.os.SystemClock;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
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 +33,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 +59,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 +168,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 +227,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;
- }
}