From c3a6d5d1d00a9b0b0c0e638e6ef04cd4fc25da3c Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 8 Apr 2015 13:32:03 +0200 Subject: modified / simplified maintain scroll position code --- src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 79b2c5c9..eaed4e02 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -189,14 +189,13 @@ public class ConversationActivity extends XmppActivity final int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); + final int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop()); swipedConversation = listAdapter.getItem(position); listAdapter.remove(swipedConversation); swipedConversation.markRead(); xmppConnectionService.getNotificationService().clear(swipedConversation); - final int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop()); - if (position == 0 && listAdapter.getCount() == 0) { endConversation(swipedConversation, false, true); return null; @@ -221,8 +220,8 @@ public class ConversationActivity extends XmppActivity .reInit(getSelectedConversation()); } swipedConversation = null; + listAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index + (listView.getChildCount() < position ? 1 : 0), top); - } @Override -- cgit v1.2.3