List of usage examples for android.support.v4.content Loader getId
public int getId()
From source file:org.level28.android.moca.ui.schedule.SessionListFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (!isUsable()) { return;/*from w ww.j a va2 s . c o m*/ } // We do have valid data now mDataValid = true; // The list adapter should be (re)set here... setListAdapter(mAdapter); final int token = loader.getId(); if (token == SessionsQuery._TOKEN) { mAdapter.changeCursor(cursor); showList(); } else { cursor.close(); } }
From source file:com.ultramegasoft.flavordex2.fragment.EntryListFragment.java
@Override public void onLoaderReset(@NonNull Loader<Cursor> loader) { switch (loader.getId()) { case LOADER_ENTRIES: setActivatedPosition(ListView.INVALID_POSITION); mAdapter.swapCursor(null);/*from w w w . j a v a 2 s .c om*/ break; } }
From source file:group.pals.android.lib.ui.filechooser.utils.ui.history.HistoryFragment.java
@Override public void onLoaderReset(Loader<Cursor> loader) { if (BuildConfig.DEBUG) Log.d(_ClassName, "onLoaderReset()"); if (loader.getId() == mLoaderIdHistoryData) { mHistoryCursorAdapter.changeCursor(null); mViewLoading.setVisibility(View.VISIBLE); } // mLoaderIdHistoryData else if (loader.getId() == mLoaderIdHistoryCounter) { /*/* ww w . j a v a2s .co m*/ * NOTE: if using an adapter, set its cursor to null to release * memory. */ if (mCursorCounter != null) { mCursorCounter.close(); mCursorCounter = null; } } // mLoaderIdHistoryCounter }
From source file:com.conferenceengineer.android.iosched.ui.SessionDetailFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (!isAdded()) { return;/*from ww w . j a v a2 s . c om*/ } if (loader.getId() == SessionsQuery._TOKEN) { onSessionQueryComplete(cursor); if (mType != null && !ScheduleContract.Sessions.SESSION_TYPE_KEYNOTE.equals(mType)) { mAddScheduleButton.setVisibility(View.VISIBLE); } } else if (loader.getId() == SpeakersQuery._TOKEN) { onSpeakersQueryComplete(cursor); } else { cursor.close(); } }
From source file:cz.maresmar.sfm.view.portal.PortalDetailFragment.java
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor) { switch (loader.getId()) { case PORTAL_LOADER_ID: Timber.d("Portal data loaded"); cursor.moveToFirst();//from w w w . j a va 2 s. c o m if (BuildConfig.DEBUG) { Assert.isOne(cursor.getCount()); } // Portal name mNameText.setText(cursor.getString(0)); // Portal reference mRefText.setText(cursor.getString(1)); // Security spinner setConnectionSecurity(cursor.getInt(3)); // Location LatLng location = new LatLng(cursor.getDouble(4), cursor.getDouble(5)); if (location.latitude == 0 && location.longitude == 0) removeLocation(); else setLocation(location); // Extra setExtraData(cursor.getString(6)); // Plugin String plugin = cursor.getString(2); AsyncTask.execute(() -> { try { blockingLoaders.await(); } catch (InterruptedException e) { Timber.e(e); } getActivity().runOnUiThread(() -> { setPlugin(plugin); mPluginSpinner.setOnItemSelectedListener(mPluginChangeListen); }); }); // New menu notification @ProviderContract.PortalFlags int flags = cursor.getInt(7); mNewMenuNotificationCheckBox.setChecked(!((flags & ProviderContract.PORTAL_FLAG_DISABLE_NEW_MENU_NOTIFICATION) == ProviderContract.PORTAL_FLAG_DISABLE_NEW_MENU_NOTIFICATION)); break; default: throw new UnsupportedOperationException("Unknown loader id: " + loader.getId()); } }
From source file:com.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.java
@Override public void onLoaderReset(Loader<Cursor> loader) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onLoaderReset()"); if (loader.getId() == mLoaderBookmarkData) { mBookmarkCursorAdapter.changeCursor(null); mViewLoading.setVisibility(View.VISIBLE); } // mLoaderBookmarkData }
From source file:group.pals.android.lib.ui.filechooser.utils.ui.bookmark.BookmarkFragment.java
@Override public void onLoaderReset(Loader<Cursor> loader) { if (BuildConfig.DEBUG) Log.d(_ClassName, "onLoaderReset()"); if (loader.getId() == mLoaderBookmarkData) { mBookmarkCursorAdapter.changeCursor(null); mViewLoading.setVisibility(View.VISIBLE); } // mLoaderBookmarkData }
From source file:li.barter.fragments.BooksAroundMeFragment.java
@Override public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) { if (loader.getId() == Loaders.SEARCH_BOOKS) { if ((cursor.getCount() == 0)) { mBooksAroundMeGridView.setEmptyView(mEmptyView); }/* ww w .ja v a 2 s. co m*/ Logger.d(TAG, "Cursor Loaded with count: %d", cursor.getCount()); mBooksAroundMeAdapter.swapCursor(cursor); hideRefreshing(); } }
From source file:com.ute.bihapi.wydarzeniatekstowe.thirdScreenActivities.ContactsListFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // This swaps the new cursor into the adapter. if (loader.getId() == ContactsQuery.QUERY_ID) { mAdapter.swapCursor(data);/*from ww w. j a v a2s . co m*/ // If this is a two-pane layout and there is a search query then // there is some additional work to do around default selected // search item. if (!TextUtils.isEmpty(mSearchTerm) && mSearchQueryChanged) { // Selects the first item in results, unless this fragment has // been restored from a saved state (like orientation change) // in which case it selects the previously selected search item. if (data != null && data.moveToPosition(mPreviouslySelectedSearchItem)) { // Creates the content Uri for the previously selected contact by appending the // contact's ID to the Contacts table content Uri final Uri uri = Uri.withAppendedPath(Contacts.CONTENT_URI, String.valueOf(data.getLong(ContactsQuery.ID))); mOnContactSelectedListener.onContactSelected(uri); getListView().setItemChecked(mPreviouslySelectedSearchItem, true); } else { // No results, clear selection. onSelectionCleared(); } // Only restore from saved state one time. Next time fall back // to selecting first item. If the fragment state is saved again // then the currently selected item will once again be saved. mPreviouslySelectedSearchItem = 0; mSearchQueryChanged = false; } } }
From source file:com.haibison.android.anhuu.utils.ui.history.HistoryFragment.java
@Override public void onLoaderReset(Loader<Cursor> loader) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onLoaderReset()"); if (loader.getId() == mLoaderIdHistoryData) { mHistoryCursorAdapter.changeCursor(null); mViewLoading.setVisibility(View.VISIBLE); } // mLoaderIdHistoryData else if (loader.getId() == mLoaderIdHistoryCounter) { /*//from ww w. java2 s . c o m * NOTE: if using an adapter, set its cursor to null to release * memory. */ if (mCursorCounter != null) { mCursorCounter.close(); mCursorCounter = null; } } // mLoaderIdHistoryCounter }