fix LoaderManager inefficiencies

Redundant calls in ConversationActivity and ConversationListActivity
was causing unnecessary view invalidations.

Closes #2592
This commit is contained in:
Rhodey Orbits 2015-03-05 16:06:11 -08:00 committed by Jake McGinty
parent ca2c8b961e
commit db7a657001
2 changed files with 5 additions and 9 deletions

View File

@ -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();

View File

@ -96,8 +96,6 @@ public class ConversationListFragment extends ListFragment
}); });
initializeListAdapter(); initializeListAdapter();
initializeBatchListener(); initializeBatchListener();
getLoaderManager().initLoader(0, null, this);
} }
@Override @Override