Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void initializeSortManager(final List<Call> callList, final IRequestView iRequestView) {
- LoaderManager.LoaderCallbacks<ArrayList<BarEntry>> arrayListLoaderCallbacks = new LoaderManager.LoaderCallbacks<ArrayList<BarEntry>>() {
- @Override
- public Loader<ArrayList<BarEntry>> onCreateLoader(int id, Bundle args) {
- if (iRequestView instanceof CallsPresenter.ICallsView) {
- Timber.d("return new CallsEntryLoader");
- return new CallsEntryLoader(getActivity(), callList);
- } else if (iRequestView instanceof MessagesPresenter.IMessagesView) {
- Timber.d("return new MessagesEntryLoader");
- return new MessagesEntryLoader(getActivity(), callList);
- }
- throw new RuntimeException("Invalid Loader type");
- }
- @Override
- public void onLoadFinished(Loader<ArrayList<BarEntry>> loader, ArrayList<BarEntry> callEntries) {
- if (iRequestView instanceof CallsPresenter.ICallsView) {
- Timber.d("setCallsChartData Calls");
- setCallsChartData(callEntries);
- } else if (iRequestView instanceof MessagesPresenter.IMessagesView) {
- Timber.d("setCallsChartData Messages");
- setMessagesChartData(callEntries);
- }
- }
- @Override
- public void onLoaderReset(Loader<ArrayList<BarEntry>> loader) {
- }
- };
- if (isVisible() && iRequestView instanceof CallsPresenter.ICallsView) {
- getLoaderManager().initLoader(0, null, arrayListLoaderCallbacks).forceLoad();
- } else if (isVisible() && iRequestView instanceof MessagesPresenter.IMessagesView) {
- getLoaderManager().initLoader(1, null, arrayListLoaderCallbacks).forceLoad();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement