List of usage examples for android.support.v4.app LoaderManager restartLoader
public abstract <D> Loader<D> restartLoader(int id, Bundle args, LoaderManager.LoaderCallbacks<D> callback);
From source file:com.armannds.eldgos.katla.popularmovies.ui.MainActivity.java
private void loadMovies(int movieFilter) { showMoviesGrid();//from ww w. jav a2s . c o m mMovieFilter = movieFilter; LoaderManager loaderManager = getSupportLoaderManager(); Loader<List<Movie>> movieLoader = loaderManager.getLoader(MOVIE_LOADER); if (movieLoader == null) { loaderManager.initLoader(MOVIE_LOADER, null, this); } else { loaderManager.restartLoader(MOVIE_LOADER, null, this); } setTitle(movieFilter); }
From source file:com.gh4a.activities.SearchActivity.java
@Override public boolean onQueryTextSubmit(String query) { LoaderManager lm = getSupportLoaderManager(); switch (mSearchType.getSelectedItemPosition()) { case 1://from www .j a va 2 s.co m lm.restartLoader(0, null, mUserCallback); break; case 2: lm.restartLoader(0, null, mCodeCallback); break; default: lm.restartLoader(0, null, mRepoCallback); break; } setContentShown(false); mSearch.clearFocus(); return true; }
From source file:nu.firetech.android.pactrack.frontend.ParcelListFragment.java
@Override public void refreshDone() { LoaderManager lm = getLoaderManager(); if (lm.getLoader(PARCELS_LOADER_ID) == null) { lm.initLoader(PARCELS_LOADER_ID, null, this); } else {//from w w w. j a v a 2 s. c o m lm.restartLoader(PARCELS_LOADER_ID, null, this); } }
From source file:org.dodgybits.shuffle.android.core.listener.CursorLoader.java
private void restartCountLoading(Location location) { ViewMode viewMode = location.getViewMode(); Log.d(TAG, "Refreshing count cursor " + viewMode); final LoaderManager lm = mActivity.getSupportLoaderManager(); switch (viewMode) { case CONTEXT_LIST: lm.restartLoader(countId(), null, CONTEXT_TASK_COUNT_LOADER_CALLBACKS); break;//from ww w .j a v a2 s . c om case PROJECT_LIST: lm.restartLoader(countId(), null, PROJECT_TASK_COUNT_LOADER_CALLBACKS); break; default: // not needed for other views } }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Starts a loader using {@link LoaderManager} obtained from the given <var>activity</var> with * the current id and the specified parameters. * <p>/* w w w. j ava 2s.c o m*/ * If the LoaderManager already has a Loader with the id of this assistant, such a loader will be * restarted by {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderManager.LoaderCallbacks)}, * otherwise will be initiated by {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderManager.LoaderCallbacks)}. * <p> * <b>Note</b>, that this assistant must have valid (none negative) loader id, otherwise the * requested loader can not be started. * * @param activity Activity used to access LoaderManager instance. * @param params The desired parameters for loader. * @return {@code True} if loader was successfully started (initiated/restarted), {@code false} * otherwise. */ public boolean startLoader(@NonNull FragmentActivity activity, @Nullable Bundle params) { if (mLoaderId >= 0) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); if (loaderManager != null) { if (loaderManager.getLoader(mLoaderId) != null) { loaderManager.restartLoader(mLoaderId, params, this); } else { loaderManager.initLoader(mLoaderId, params, this); } return true; } } return false; }
From source file:com.bangz.shotrecorder.MainActivity.java
private void refreshData() { LoaderManager lm = getSupportLoaderManager(); lm.restartLoader(1, null, this); }
From source file:com.tune.news.fragment.EntriesListFragment.java
private void restartLoaders() { LoaderManager loaderManager = getLoaderManager(); loaderManager.restartLoader(ENTRIES_LOADER_ID, null, mEntriesLoader); loaderManager.restartLoader(NEW_ENTRIES_NUMBER_LOADER_ID, null, mEntriesNumberLoader); }
From source file:com.jefftharris.passwdsafe.PasswdSafeListFragment.java
/** Refresh the list due to file changes */ private void refreshList() { if (!isResumed()) { return;/*from w ww . ja va 2 s . com*/ } LoaderManager lm = getLoaderManager(); lm.destroyLoader(0); lm.restartLoader(0, null, this); boolean groupVisible = false; switch (itsMode) { case RECORDS: case NONE: { groupVisible = false; break; } case GROUPS: case ALL: { groupVisible = true; break; } } if (groupVisible) { String groupPath = itsLocation.getGroupPath(); if (TextUtils.isEmpty(groupPath)) { groupVisible = false; } else { itsGroupLabel.setText(groupPath); } } itsGroupPanel.setVisibility(groupVisible ? View.VISIBLE : View.GONE); }
From source file:mobisocial.musubi.ui.fragments.ConversationsFragment.java
void initLoaders(boolean restart) { LoaderManager lm = getLoaderManager(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);/* w ww . ja va 2s . co m*/ Bundle args = new Bundle(); args.putLong("start", cal.getTimeInMillis()); if (restart) { lm.restartLoader(0, args, this); } else { lm.initLoader(0, args, this); } cal.add(Calendar.DAY_OF_MONTH, -1); for (int i = 1; i < FeedListFragment.DAYS_TO_SHOW; i++) { long time = cal.getTimeInMillis(); args = new Bundle(); args.putLong("start", time); args.putLong("end", time + FeedListFragment.ONE_DAY); if (restart) { lm.restartLoader(i, args, this); } else { lm.initLoader(i, args, this); } cal.add(Calendar.DAY_OF_MONTH, -1); } args = new Bundle(); args.putLong("end", cal.getTimeInMillis() + FeedListFragment.ONE_DAY); if (restart) { lm.restartLoader(FeedListFragment.DAYS_TO_SHOW, args, this); } else { lm.initLoader(FeedListFragment.DAYS_TO_SHOW, args, this); } }
From source file:com.jefftharris.passwdsafe.FileListFragment.java
/** Show the files in the current directory */ private void showFiles() { String state = Environment.getExternalStorageState(); if (!Environment.MEDIA_MOUNTED.equals(state) && !Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { itsDir = null;/*from ww w . j av a2s .co m*/ } else { itsDir = getFileDir(); } LoaderManager lm = getLoaderManager(); lm.restartLoader(0, null, this); }