List of usage examples for android.app LoaderManager restartLoader
public abstract <D> Loader<D> restartLoader(int id, Bundle args, LoaderManager.LoaderCallbacks<D> callback);
From source file:net.etuldan.sparss.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.sintef_energy.ubisolar.fragments.UsageFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mDevices = new LinkedHashMap<>(); if (savedInstanceState != null && mSavedState == null) mSavedState = savedInstanceState.getBundle("mSavedState"); LoaderManager loaderManager = getLoaderManager(); //Get devices if (mSavedState != null) { mDeviceUsageList = mSavedState.getParcelableArrayList("mDeviceUsageList"); loaderManager.restartLoader(LOADER_DEVICES, null, this); } else {/*from w w w . j a v a 2 s .c om*/ mDeviceUsageList = new ArrayList<>(); loaderManager.initLoader(LOADER_DEVICES, null, this); } mPreferenceManager.setNavDrawerUsage(0); Intent i = new Intent(Global.BROADCAST_NAV_DRAWER); i.putExtra(Global.DATA_B_NAV_DRAWER_USAGE, 0); LocalBroadcastManager.getInstance(this.getActivity().getApplicationContext()).sendBroadcast(i); }
From source file:com.google.samples.apps.iosched.map.MapInfoFragment.java
/** * Prepares and starts a SessionLoader for the specified query token. *//*from w w w . java 2 s . c om*/ private void loadSessions(String roomId, String roomTitle, int roomType, int queryToken) { setHeader(MapUtils.getRoomIcon(roomType), roomTitle, null); onSessionListLoading(roomId, roomTitle); // Load the following sessions for this room LoaderManager lm = getLoaderManager(); Bundle args = new Bundle(); args.putString(QUERY_ARG_ROOMID, roomId); args.putString(QUERY_ARG_ROOMTITLE, roomTitle); args.putInt(QUERY_ARG_ROOMTYPE, roomType); lm.restartLoader(queryToken, args, this); }
From source file:com.android.browser.BookmarksPageCallbacks.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.bookmarks, container, false); mEmptyView = mRoot.findViewById(android.R.id.empty); mGrid = (BookmarkExpandableView) mRoot.findViewById(R.id.grid); mGrid.setOnChildClickListener(this); mGrid.setColumnWidthFromLayout(R.layout.bookmark_thumbnail); mGrid.setBreadcrumbController(this); setEnableContextMenu(mEnableContextMenu); // Start the loaders LoaderManager lm = getLoaderManager(); lm.restartLoader(LOADER_ACCOUNTS, null, this); return mRoot; }
From source file:com.android.xbrowser.BookmarksPageCallbacks.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.bookmarks, container, false); mEmptyView = mRoot.findViewById(android.R.id.empty); mGrid = (BookmarkExpandableView) mRoot.findViewById(R.id.grid); mGrid.setOnChildClickListener(this); mGrid.setColumnWidthFromLayout(R.layout.bookmark_thumbnail); mGrid.setBreadcrumbController(this); setEnableContextMenu(mEnableContextMenu); mDragHandler = new BookmarkDragHandler(getActivity(), mDragController, mGrid.getDragAdapter()); // Start the loaders LoaderManager lm = getLoaderManager(); lm.restartLoader(LOADER_ACCOUNTS, null, this); return mRoot; }
From source file:com.antew.redditinpictures.library.ui.base.BaseFragmentActivityWithMenu.java
protected void filterSubreddits(String filterText) { LoaderManager loaderManager = getLoaderManager(); Bundle filterBundle = new Bundle(); filterBundle.putString(Constants.Extra.EXTRA_QUERY, filterText); loaderManager.restartLoader(Constants.Loader.LOADER_SUBREDDITS, filterBundle, this); }
From source file:com.borqs.browser.combo.BookmarksPageCallbacks.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.bookmarks, container, false); mEmptyView = mRoot.findViewById(android.R.id.empty); mGrid = (BookmarkExpandableView) mRoot.findViewById(R.id.grid); mGrid.setOnChildClickListener(this); mGrid.setColumnWidthFromLayout(R.layout.combo_bookmark_thumbnail); mGrid.setBreadcrumbController(this); setEnableContextMenu(mEnableContextMenu); // Start the loaders LoaderManager lm = getLoaderManager(); lm.restartLoader(LOADER_ACCOUNTS, null, this); return mRoot; }
From source file:com.borqs.browser.combo.BookmarksPageCallbacks.java
/** * Create a new BrowserBookmarksPage.// ww w . ja v a2 s.com */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); /* SharedPreferences prefs = BrowserSettings.getInstance().getPreferences(); try { mState = new JSONObject(prefs.getString(PREF_GROUP_STATE, "{}")); } catch (JSONException e) { // Parse failed, clear preference and start with empty state prefs.edit().remove(PREF_GROUP_STATE).apply(); } */ mState = new JSONObject(); // Bundle args = getArguments(); mDisableNewWindow = icicle == null ? false : icicle.getBoolean(EXTRA_DISABLE_WINDOW, false); /* // setHasOptionsMenu(true); if (mCallbacks == null && this instanceof CombinedBookmarksCallbacks) { mCallbacks = new CombinedBookmarksCallbackWrapper( (CombinedBookmarksCallbacks) this); }*/ mRoot = LayoutInflater.from(this).inflate(R.layout.combo_bookmarks, null, false); mEmptyView = mRoot.findViewById(android.R.id.empty); mGrid = (BookmarkExpandableView) mRoot.findViewById(R.id.grid); mGrid.setOnChildClickListener(this); mGrid.setColumnWidthFromLayout(R.layout.combo_bookmark_thumbnail); mGrid.setBreadcrumbController(this); setEnableContextMenu(mEnableContextMenu); // Start the loaders LoaderManager lm = getLoaderManager(); lm.restartLoader(LOADER_ACCOUNTS, null, this); this.setContentView(mRoot); }
From source file:com.frostwire.android.gui.fragments.MyFilesFragment.java
private void reloadFiles(byte fileType) { try {//from w ww. j a v a 2s . c om if (isAdded()) { LoaderManager loaderManager = getLoaderManager(); loaderManager.destroyLoader(LOADER_FILES_ID); Bundle bundle = new Bundle(); bundle.putByte("fileType", fileType); loaderManager.restartLoader(LOADER_FILES_ID, bundle, this); } } catch (Throwable t) { LOG.error(t.getMessage(), t); } }
From source file:com.chen.mail.ui.FolderListFragment.java
/** * Sets the current account to the one provided here. * @param account the current account to set to. *///from w w w. j ava2s. co m private void setSelectedAccount(Account account) { final boolean changed = (account != null) && (mCurrentAccount == null || !mCurrentAccount.uri.equals(account.uri)); mCurrentAccount = account; if (changed) { // We no longer have proper folder objects. Let the new ones come in mCursorAdapter.setCursor(null); // If currentAccount is different from the one we set, restart the loader. Look at the // comment on {@link AbstractActivityController#restartOptionalLoader} to see why we // don't just do restartLoader. final LoaderManager manager = getLoaderManager(); manager.destroyLoader(FOLDER_LIST_LOADER_ID); manager.restartLoader(FOLDER_LIST_LOADER_ID, Bundle.EMPTY, this); manager.destroyLoader(ALL_FOLDER_LIST_LOADER_ID); manager.restartLoader(ALL_FOLDER_LIST_LOADER_ID, Bundle.EMPTY, this); // An updated cursor causes the entire list to refresh. No need to refresh the list. // But we do need to blank out the current folder, since the account might not be // synced. mSelectedFolderUri = FolderUri.EMPTY; mCurrentFolderForUnreadCheck = null; } else if (account == null) { // This should never happen currently, but is a safeguard against a very incorrect // non-null account -> null account transition. LogUtils.e(LOG_TAG, "FLF.setSelectedAccount(null) called! Destroying existing loader."); final LoaderManager manager = getLoaderManager(); manager.destroyLoader(FOLDER_LIST_LOADER_ID); manager.destroyLoader(ALL_FOLDER_LIST_LOADER_ID); } }