aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/ConversationActivity.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-09-29 18:28:13 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-09-29 18:28:13 +0200
commit511b7a53f41f8254449e6c2c6eff795f728e7a33 (patch)
tree4ff79e0bd9f041f698a0d6787069c67f0bf53e0e /src/eu/siacs/conversations/ui/ConversationActivity.java
parent87010e6094cc35ece98d3beadbbfbc59ea0a25b3 (diff)
notifiy only when necessary
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index 3accafe8..03cf753d 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -12,7 +12,6 @@ import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdat
import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
import eu.siacs.conversations.utils.ExceptionHelper;
-import eu.siacs.conversations.utils.UIHelper;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -144,6 +143,9 @@ public class ConversationActivity extends XmppActivity implements
}
invalidateOptionsMenu();
hideKeyboard();
+ if (xmppConnectionServiceBound) {
+ xmppConnectionService.getNotificationService().setOpenConversation(null);
+ }
}
@Override
@@ -151,19 +153,7 @@ public class ConversationActivity extends XmppActivity implements
paneShouldBeOpen = false;
if ((conversationList.size() > 0)
&& (getSelectedConversation() != null)) {
- ActionBar ab = getActionBar();
- if (ab != null) {
- ab.setDisplayHomeAsUpEnabled(true);
- ab.setHomeButtonEnabled(true);
- if (getSelectedConversation().getMode() == Conversation.MODE_SINGLE
- || activity.useSubjectToIdentifyConference()) {
- ab.setTitle(getSelectedConversation().getName());
- } else {
- ab.setTitle(getSelectedConversation()
- .getContactJid().split("/")[0]);
- }
- }
- invalidateOptionsMenu();
+ openConversation(getSelectedConversation());
if (!getSelectedConversation().isRead()) {
xmppConnectionService
.markRead(getSelectedConversation());
@@ -179,6 +169,25 @@ public class ConversationActivity extends XmppActivity implements
}
});
}
+
+ public void openConversation(Conversation conversation) {
+ ActionBar ab = getActionBar();
+ if (ab != null) {
+ ab.setDisplayHomeAsUpEnabled(true);
+ ab.setHomeButtonEnabled(true);
+ if (getSelectedConversation().getMode() == Conversation.MODE_SINGLE
+ || activity.useSubjectToIdentifyConference()) {
+ ab.setTitle(getSelectedConversation().getName());
+ } else {
+ ab.setTitle(getSelectedConversation()
+ .getContactJid().split("/")[0]);
+ }
+ }
+ invalidateOptionsMenu();
+ if (xmppConnectionServiceBound) {
+ xmppConnectionService.getNotificationService().setOpenConversation(conversation);
+ }
+ }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -603,6 +612,7 @@ public class ConversationActivity extends XmppActivity implements
xmppConnectionService.removeOnConversationListChangedListener();
xmppConnectionService.removeOnAccountListChangedListener();
xmppConnectionService.removeOnRosterUpdateListener();
+ xmppConnectionService.getNotificationService().setOpenConversation(null);
}
super.onStop();
}