public void loadAlbums() { mLoaderManager.initLoader(LOADER_ID, null, this); }
private void startOrResumeDecodeMessage() { LocalMessageExtractorLoader loader = (LocalMessageExtractorLoader) loaderManager.<MessageViewInfo>getLoader(DECODE_MESSAGE_LOADER_ID); boolean isLoaderStale = (loader == null) || !loader.isCreatedFor(localMessage, messageCryptoAnnotations); if (isLoaderStale) { Timber.d("Creating new decode message loader"); loaderManager.restartLoader(DECODE_MESSAGE_LOADER_ID, null, decodeMessageLoaderCallback); } else { Timber.d("Reusing decode message loader"); loaderManager.initLoader(DECODE_MESSAGE_LOADER_ID, null, decodeMessageLoaderCallback); } }
@Override protected void performFiltering(@NonNull CharSequence text, int start, int end, int keyCode) { if (loaderManager == null) { return; } String query = text.subSequence(start, end).toString(); if (TextUtils.isEmpty(query) || query.length() < MINIMUM_LENGTH_FOR_FILTERING) { loaderManager.destroyLoader(LOADER_ID_FILTERING); return; } Bundle args = new Bundle(); args.putString(ARG_QUERY, query); loaderManager.restartLoader(LOADER_ID_FILTERING, args, this); }
private void restartLoader() { if (cursorValid == null) { return; } // Refresh the message list LoaderManager loaderManager = getLoaderManager(); for (int i = 0; i < accountUuids.length; i++) { loaderManager.restartLoader(i, null, this); cursorValid[i] = false; } }
public void onDestroy() { if (mLoaderManager != null) { mLoaderManager.destroyLoader(LOADER_ID); } mCallbacks = null; }
private boolean hasLoadingAttachments() { for (Attachment attachment : attachments.values()) { Loader loader = loaderManager.getLoader(attachment.loaderId); if (loader != null && loader.isStarted()) { return true; } } return false; }
@Override public boolean onQueryTextChange(String newText) { currentFilter = newText; getLoaderManager().restartLoader(0, null, this); return true; }
public void onDestroy() { if (mLoaderManager != null) { mLoaderManager.destroyLoader(LOADER_ID); } mCallbacks = null; }
public LoaderManagerAssert hasLoader(int id) { isNotNull(); assertThat(actual.getLoader(id)) .overridingErrorMessage("Expected loader with ID <%s> but was not present.", id) .isNotNull(); return this; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getLoaderManager().initLoader(R.id.loader_id_media_store_data, null, this); }
private void startOrResumeLocalMessageLoader() { LocalMessageLoader loader = (LocalMessageLoader) loaderManager.<LocalMessage>getLoader(LOCAL_MESSAGE_LOADER_ID); boolean isLoaderStale = (loader == null) || !loader.isCreatedFor(messageReference); if (isLoaderStale) { Timber.d("Creating new local message loader"); cancelAndClearCryptoOperation(); cancelAndClearDecodeLoader(); loaderManager.restartLoader(LOCAL_MESSAGE_LOADER_ID, null, localMessageLoaderCallback); } else { Timber.d("Reusing local message loader"); loaderManager.initLoader(LOCAL_MESSAGE_LOADER_ID, null, localMessageLoaderCallback); } }
/** * This method is called after this activity has been paused or restarted. * Often, this is after new data has been inserted through an AddTaskActivity, * so this restarts the loader to re-query the underlying data for any changes. */ @Override protected void onResume() { super.onResume(); // re-queries for all tasks getSupportLoaderManager().restartLoader(TASK_LOADER_ID, null, this); }
private void cancelAndClearLocalMessageLoader() { loaderManager.destroyLoader(LOCAL_MESSAGE_LOADER_ID); }
public void load(@Nullable Album target, boolean enableCapture) { Bundle args = new Bundle(); args.putParcelable(ARGS_ALBUM, target); args.putBoolean(ARGS_ENABLE_CAPTURE, enableCapture); mLoaderManager.initLoader(LOADER_ID, args, this); }
Loader<String> githubSearchLoader = loaderManager.getLoader(GITHUB_SEARCH_LOADER); if (githubSearchLoader == null) { loaderManager.initLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } else { loaderManager.restartLoader(GITHUB_SEARCH_LOADER, queryBundle, this);
/** * This method is called after this activity has been paused or restarted. * Often, this is after new data has been inserted through an AddTaskActivity, * so this restarts the loader to re-query the underlying data for any changes. */ @Override protected void onResume() { super.onResume(); // re-queries for all tasks getSupportLoaderManager().restartLoader(TASK_LOADER_ID, null, this); }
private void cancelAndClearDecodeLoader() { loaderManager.destroyLoader(DECODE_MESSAGE_LOADER_ID); }
private void initAttachmentContentLoader(Attachment attachment) { if (attachment.state != LoadingState.METADATA) { throw new IllegalStateException("initAttachmentContentLoader can only be called for METADATA state!"); } Bundle bundle = new Bundle(); bundle.putParcelable(LOADER_ARG_ATTACHMENT, attachment.uri); loaderManager.initLoader(attachment.loaderId, bundle, mAttachmentContentLoaderCallback); }
Loader<String> githubSearchLoader = loaderManager.getLoader(GITHUB_SEARCH_LOADER); loaderManager.initLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } else { loaderManager.restartLoader(GITHUB_SEARCH_LOADER, queryBundle, this);
/** * This method is called after this activity has been paused or restarted. * Often, this is after new data has been inserted through an AddTaskActivity, * so this restarts the loader to re-query the underlying data for any changes. */ @Override protected void onResume() { super.onResume(); // re-queries for all tasks getSupportLoaderManager().restartLoader(TASK_LOADER_ID, null, this); }