aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui
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
parent87010e6094cc35ece98d3beadbbfbc59ea0a25b3 (diff)
notifiy only when necessary
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java38
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java11
2 files changed, 25 insertions, 24 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();
}
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 7916560d..064b00be 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -379,16 +379,7 @@ public class ConversationFragment extends Fragment {
if (activity.getSlidingPaneLayout().isSlideable()) {
if (!activity.shouldPaneBeOpen()) {
activity.getSlidingPaneLayout().closePane();
- activity.getActionBar().setDisplayHomeAsUpEnabled(true);
- activity.getActionBar().setHomeButtonEnabled(true);
- if (conversation.getMode() == Conversation.MODE_SINGLE
- || activity.useSubjectToIdentifyConference()) {
- activity.getActionBar().setTitle(conversation.getName());
- } else {
- activity.getActionBar().setTitle(
- conversation.getContactJid().split("/")[0]);
- }
- activity.invalidateOptionsMenu();
+ activity.openConversation(conversation);
}
}
if (this.conversation.getMode() == Conversation.MODE_MULTI) {