mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 22:03:54 +00:00
fix LoaderManager inefficiencies
Redundant calls in ConversationActivity and ConversationListActivity was causing unnecessary view invalidations. Closes #2592
This commit is contained in:
parent
ca2c8b961e
commit
db7a657001
@ -103,7 +103,6 @@ public class ConversationFragment extends ListFragment
|
|||||||
|
|
||||||
initializeResources();
|
initializeResources();
|
||||||
initializeListAdapter();
|
initializeListAdapter();
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
@ -117,7 +116,7 @@ public class ConversationFragment extends ListFragment
|
|||||||
(!this.recipients.isSingleRecipient()) || this.recipients.isGroupRecipient(),
|
(!this.recipients.isSingleRecipient()) || this.recipients.isGroupRecipient(),
|
||||||
DirectoryHelper.isPushDestination(getActivity(), this.recipients)));
|
DirectoryHelper.isPushDestination(getActivity(), this.recipients)));
|
||||||
getListView().setRecyclerListener((ConversationAdapter)getListAdapter());
|
getListView().setRecyclerListener((ConversationAdapter)getListAdapter());
|
||||||
getLoaderManager().initLoader(0, null, this);
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,12 +126,9 @@ public class ConversationFragment extends ListFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setCorrectMenuVisibility(Menu menu) {
|
private void setCorrectMenuVisibility(Menu menu) {
|
||||||
ConversationAdapter adapter = (ConversationAdapter) getListAdapter();
|
|
||||||
List<MessageRecord> messageRecords = getSelectedMessageRecords();
|
List<MessageRecord> messageRecords = getSelectedMessageRecords();
|
||||||
|
|
||||||
if (actionMode != null && messageRecords.size() == 0) {
|
if (actionMode != null && messageRecords.size() == 0) {
|
||||||
adapter.getBatchSelected().clear();
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -170,10 +166,12 @@ public class ConversationFragment extends ListFragment
|
|||||||
|
|
||||||
public void reload(Recipients recipients, long threadId) {
|
public void reload(Recipients recipients, long threadId) {
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
this.threadId = threadId;
|
|
||||||
|
|
||||||
|
if (this.threadId != threadId) {
|
||||||
|
this.threadId = threadId;
|
||||||
initializeListAdapter();
|
initializeListAdapter();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void scrollToBottom() {
|
public void scrollToBottom() {
|
||||||
final ListView list = getListView();
|
final ListView list = getListView();
|
||||||
|
@ -96,8 +96,6 @@ public class ConversationListFragment extends ListFragment
|
|||||||
});
|
});
|
||||||
initializeListAdapter();
|
initializeListAdapter();
|
||||||
initializeBatchListener();
|
initializeBatchListener();
|
||||||
|
|
||||||
getLoaderManager().initLoader(0, null, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user