From 82bd7e17f10fad1979659db10dbf5b6b3a62abb1 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 21 Jan 2017 12:14:08 +0100 Subject: don't prematurly mark conversation as read during activity start --- .../java/de/pixart/messenger/ui/ConversationActivity.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 343d4f3ce..639baa893 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -120,6 +120,7 @@ public class ConversationActivity extends XmppActivity final private List mPendingVideoUris = new ArrayList<>(); private String mOpenConversation = null; private boolean mPanelOpen = true; + private AtomicBoolean mShouldPanelBeOpen = new AtomicBoolean(false); private Pair mScrollPosition = null; private Uri mPendingGeoUri = null; private boolean forbidProcessingPendings = false; @@ -155,6 +156,7 @@ public class ConversationActivity extends XmppActivity public void showConversationsOverview() { if (mContentView instanceof SlidingPaneLayout) { SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView; + mShouldPanelBeOpen.set(true); mSlidingPaneLayout.openPane(); } } @@ -172,6 +174,7 @@ public class ConversationActivity extends XmppActivity public void hideConversationsOverview() { if (mContentView instanceof SlidingPaneLayout) { SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView; + mShouldPanelBeOpen.set(false); mSlidingPaneLayout.closePane(); } } @@ -186,8 +189,7 @@ public class ConversationActivity extends XmppActivity public boolean isConversationsOverviewVisable() { if (mContentView instanceof SlidingPaneLayout) { - SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView; - return mSlidingPaneLayout.isOpen(); + return mShouldPanelBeOpen.get(); } else { return true; } @@ -334,18 +336,19 @@ public class ConversationActivity extends XmppActivity @Override public void onPanelOpened(View arg0) { + mShouldPanelBeOpen.set(true); updateActionBarTitle(); invalidateOptionsMenu(); hideKeyboard(); if (xmppConnectionServiceBound) { - xmppConnectionService.getNotificationService() - .setOpenConversation(null); + xmppConnectionService.getNotificationService().setOpenConversation(null); } closeContextMenu(); } @Override public void onPanelClosed(View arg0) { + mShouldPanelBeOpen.set(false); listView.discardUndo(); openConversation(); } @@ -1525,6 +1528,9 @@ public class ConversationActivity extends XmppActivity if (!ExceptionHelper.checkForCrash(this, this.xmppConnectionService)) { openBatteryOptimizationDialogIfNeeded(); } + if (isConversationsOverviewVisable() && isConversationsOverviewHideable()) { + xmppConnectionService.getNotificationService().setOpenConversation(null); + } } private void handleViewConversationIntent(final Intent intent) { -- cgit v1.2.3