From 867362ac4f0629f28da6686fa4e48a35a3521034 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 25 Feb 2019 02:01:28 +0100 Subject: [PATCH] force redraw of stacked contact requests --- .../securesms/ConversationListFragment.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index 14032281b..03d2d13aa 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -337,6 +337,8 @@ public class ConversationListFragment extends Fragment return new DcChatlistLoader(getActivity(), listflags, queryFilter.isEmpty()? null : queryFilter, 0); } + + boolean forceListRedraw; @Override public void onLoadFinished(Loader arg0, DcChatlist chatlist) { if (chatlist.getCnt() <= 0 && TextUtils.isEmpty(queryFilter) && !archive) { @@ -356,7 +358,18 @@ public class ConversationListFragment extends Fragment fab.stopPulse(); } + // this hack is needed as otherwise, for whatever reason, + // swiped contact request show an empty item if there pops up a new contact request imediately. + // anyone who wants to invesigate to this is very welcome :) + if (forceListRedraw) { + list.setLayoutManager(null); + list.getRecycledViewPool().clear(); + list.setLayoutManager(new LinearLayoutManager(getActivity())); + forceListRedraw = false; + } + getListAdapter().changeData(chatlist); + } @Override @@ -525,6 +538,7 @@ public class ConversationListFragment extends Fragment if (threadId==DcChat.DC_CHAT_ID_DEADDROP) { int contactId = ((ConversationListItem)viewHolder.itemView).getContactId(); dcContext.marknoticedContact(contactId); + forceListRedraw = true; return; }