aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-04 13:01:07 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-04 13:01:07 +0200
commitcaf214c2123b481fedd296cccdfb1c22be1df5a4 (patch)
tree5f49eb9235138806051a3eb5bf6bd1cf420196ff /src/eu/siacs/conversations/utils
parentdb4559efdffebdb2a723d960d929d0f01406f002 (diff)
fixing more notification f-ups
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r--src/eu/siacs/conversations/utils/UIHelper.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java
index 9b9fd8a99..3cc99dc5b 100644
--- a/src/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/eu/siacs/conversations/utils/UIHelper.java
@@ -187,15 +187,11 @@ public class UIHelper {
if ((currentCon != null) &&(currentCon.getMode() == Conversation.MODE_MULTI)&&(!alwaysNotify)) {
String nick = currentCon.getMucOptions().getNick();
notify = currentCon.getLatestMessage().getBody().contains(nick);
- /*if (!notify) {
- //mNotificationManager.cancel(2342);
- return;
- }*/
}
List<Conversation> unread = new ArrayList<Conversation>();
for (Conversation conversation : conversations) {
- if (!conversation.isRead()) {
+ if ((!conversation.isRead())&&((wasHighlighted(conversation)||(alwaysNotify)))) {
unread.add(conversation);
}
}
@@ -289,6 +285,21 @@ public class UIHelper {
}
}
+ private static boolean wasHighlighted(Conversation conversation) {
+ List<Message> messages = conversation.getMessages();
+ String nick = conversation.getMucOptions().getNick();
+ for(int i = messages.size() - 1; i >= 0; --i) {
+ if (messages.get(i).isRead()) {
+ break;
+ } else {
+ if (messages.get(i).getBody().contains(nick)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public static void prepareContactBadge(final Activity activity,
QuickContactBadge badge, final Contact contact) {
if (contact.getSystemAccount() != null) {