Revert "Speed up Conversations Overview with UI thread"

This reverts commit fce0c72a51.
This commit is contained in:
Arne 2024-08-26 16:57:55 +02:00
parent aaa1ef1a05
commit 782f5d354a

View file

@ -309,9 +309,9 @@ public class ConversationsOverviewFragment extends XmppFragment {
this.mSwipeEscapeVelocity = getResources().getDimension(R.dimen.swipe_escape_velocity);
this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false);
this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity()));
activity.runOnUiThread(() -> {
this.conversationsAdapter = new ConversationAdapter(this.activity, this.conversations);
if (!this.conversations.isEmpty()) {
if (this.conversations.size() > 0) {
this.activity.xmppConnectionService.updateNotificationChannels();
}
this.conversationsAdapter.setConversationClickListener((view, conversation) -> {
@ -324,7 +324,6 @@ public class ConversationsOverviewFragment extends XmppFragment {
this.binding.list.setAdapter(this.conversationsAdapter);
this.binding.list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
registerForContextMenu(this.binding.list);
});
if (activity.xmppConnectionService != null && !activity.xmppConnectionService.getBooleanPreference("hide_donation_snackbar", R.bool.hide_donation_snackbar)) {
askForDonationSnackbar();
}
@ -522,7 +521,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
return;
}
this.activity.xmppConnectionService.populateWithOrderedConversations(this.conversations);
if (!this.conversations.isEmpty()) {
if (this.conversations.size() > 0) {
this.activity.xmppConnectionService.updateNotificationChannels();
}
Conversation removed = this.swipedConversation.peek();
@ -533,9 +532,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
pendingActionHelper.execute();
}
}
activity.runOnUiThread(() -> {
this.conversationsAdapter.notifyDataSetChanged();
});
ScrollState scrollState = pendingScrollState.pop();
if (scrollState != null) {
setScrollPosition(scrollState);