aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 69e90cc1..82939355 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -115,7 +115,6 @@ public class ConversationActivity extends XmppActivity
public void hideConversationsOverview() {
if (mContentView instanceof SlidingPaneLayout) {
- listView.discardUndo();
SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView;
mSlidingPaneLayout.closePane();
}
@@ -185,26 +184,35 @@ public class ConversationActivity extends XmppActivity
@Override
public EnhancedListView.Undoable onDismiss(EnhancedListView enhancedListView, final int position) {
+
+ boolean formerlySelected;
swipedConversation = listAdapter.getItem(position);
listAdapter.remove(swipedConversation);
- listAdapter.notifyDataSetChanged();
swipedConversation.markRead();
if (position == 0 && listAdapter.getCount() == 0) {
endConversation(swipedConversation, false, true);
return null;
- }
- else if (getSelectedConversation() == swipedConversation) {
+ } else if (getSelectedConversation() == swipedConversation) {
+ formerlySelected = true;
setSelectedConversation(listAdapter.getItem(0));
ConversationActivity.this.mConversationFragment
.reInit(getSelectedConversation());
+ } else {
+ formerlySelected = false;
}
+ final boolean wasSelected = formerlySelected;
return new EnhancedListView.Undoable() {
+
@Override
public void undo() {
listAdapter.insert(swipedConversation, position);
- listAdapter.notifyDataSetChanged();
+ if (wasSelected) {
+ setSelectedConversation(swipedConversation);
+ ConversationActivity.this.mConversationFragment
+ .reInit(getSelectedConversation());
+ }
swipedConversation = null;
}
@@ -262,6 +270,7 @@ public class ConversationActivity extends XmppActivity
@Override
public void onPanelClosed(View arg0) {
+ listView.discardUndo();
openConversation();
}