List of usage examples for android.support.v4.content Loader getId
public int getId()
From source file:gov.wa.wsdot.android.wsdot.ui.FavoritesFragment.java
public void onLoaderReset(Loader<Cursor> loader) { swipeRefreshLayout.setRefreshing(false); switch (loader.getId()) { case 0://from ww w.j a v a 2s . c o m mCameraAdapter.swapCursor(null); break; case 1: mMountainPassAdapter.swapCursor(null); break; case 2: mTravelTimesAdapter.swapCursor(null); break; case 3: mFerriesSchedulesAdapter.swapCursor(null); break; } }
From source file:com.google.android.apps.iosched.ui.gtv.GoogleTVSessionLivestreamActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { mHandler.removeCallbacks(mNextSessionStartsInCountdownRunnable); switch (loader.getId()) { case SessionSummaryQuery._TOKEN: loadSession(data);//from w ww.j a v a 2 s . co m break; case SessionsQuery._TOKEN: mLivestreamAdapter.swapCursor(data); final int selected = locateSelectedItem(data); if (data.getCount() == 0) { handleNoLiveSessionsAvailable(); } else { mLiveListView.setSelection(selected); mLiveListView.requestFocus(selected); final Cursor cursor = (Cursor) mLivestreamAdapter.getItem(selected); final String sessionId = cursor.getString(SessionsQuery.SESSION_ID); if (sessionId != null) { reloadFromUri(Sessions.buildSessionUri(sessionId)); } } break; case UPCOMING_SESSIONS_QUERY_ID: if (data != null && data.getCount() > 0) { data.moveToFirst(); handleUpdateNextUpcomingSession(data); } break; } }
From source file:fr.mixit.android.ui.fragments.SessionDetailsFragment.java
@Override public void onLoaderReset(Loader<Cursor> loader) { final int id = loader.getId(); if (id == CURSOR_SESSION) { displaySession(null);//from w w w . ja v a 2 s. c o m } else if (id == CURSOR_SPEAKERS) { displaySpeakers(null); } else if (id == CURSOR_INTERESTS) { displayInterests(null); } }
From source file:com.ultramegasoft.flavordex2.fragment.ViewFlavorsFragment.java
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) { if (data == null) { return;/*w w w .j av a2s . c o m*/ } data.moveToPosition(-1); final ArrayList<RadarHolder> flavorValues = new ArrayList<>(); String name; int value; switch (loader.getId()) { case LOADER_FLAVOR: while (data.moveToNext()) { name = data.getString(data.getColumnIndex(Tables.EntriesFlavors.FLAVOR)); value = data.getInt(data.getColumnIndex(Tables.EntriesFlavors.VALUE)); flavorValues.add(new RadarHolder(name, value)); } if (flavorValues.isEmpty()) { getLoaderManager().initLoader(LOADER_DEFAULT_FLAVOR, null, this); break; } mData = flavorValues; if (mRadarView.getVisibility() != View.VISIBLE) { mRadarView.startAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in)); } if (!mEditMode) { mRadarView.setData(flavorValues); } break; case LOADER_DEFAULT_FLAVOR: case LOADER_RESET_FLAVOR: while (data.moveToNext()) { name = data.getString(data.getColumnIndex(Tables.Flavors.NAME)); flavorValues.add(new RadarHolder(name, 0)); } mRadarView.setData(flavorValues); if (loader.getId() == LOADER_RESET_FLAVOR) { if (!mEditMode) { setEditMode(true, true); } else { mRadarView.turnTo(0); } } break; } mRadarView.setVisibility(View.VISIBLE); }
From source file:com.gh4a.IssueListActivity.java
@Override public void onLoadFinished(Loader loader, Object object) { HashMap<Integer, Object> result = (HashMap<Integer, Object>) object; if (!isLoaderError(result)) { Object data = result.get(LoaderResult.DATA); if (loader.getId() == 0) { stopProgressDialog(mProgressDialog); mLabels = (List<Label>) data; showLabelsDialog();//from w ww. ja v a2 s .co m } else if (loader.getId() == 1) { stopProgressDialog(mProgressDialog); mMilestones = (List<Milestone>) data; showMilestonesDialog(); } else if (loader.getId() == 2) { stopProgressDialog(mProgressDialog); mAssignees = (List<User>) data; showAssigneesDialog(); } else { isCollaborator = (Boolean) data; } } else { stopProgressDialog(mProgressDialog); invalidateOptionsMenu(); } }
From source file:fr.mixit.android.ui.fragments.SessionDetailsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { final int id = loader.getId(); if (id == CURSOR_SESSION) { displaySession(data);//from w w w . ja v a2 s. c o m } else if (id == CURSOR_SPEAKERS) { displaySpeakers(data); } else if (id == CURSOR_INTERESTS) { displayInterests(data); } }
From source file:com.conferenceengineer.android.iosched.ui.SessionsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null) { return;/*from w w w . java 2 s . co m*/ } int token = loader.getId(); if (token == SessionsQuery._TOKEN || token == SearchQuery._TOKEN) { mAdapter.changeCursor(cursor); Bundle arguments = getArguments(); if (arguments != null && arguments.containsKey("_uri")) { String uri = arguments.get("_uri").toString(); if (uri != null && uri.contains("blocks")) { String title = arguments.getString(Intent.EXTRA_TITLE); if (title == null) { title = (String) this.getActivity().getTitle(); } LOGD("Tracker", "Session Block: " + title); } } } else { LOGD(TAG, "Query complete, Not Actionable: " + token); cursor.close(); } mMultiSelectionController.tryRestoreInstanceState(); }
From source file:com.syncedsynapse.kore2.ui.TVShowEpisodeDetailsFragment.java
/** {@inheritDoc} */ @Override/*from w ww . j av a 2 s.c o m*/ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_EPISODE: displayEpisodeDetails(cursor); break; // case LOADER_CAST: // displayCastList(cursor); // break; } } }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyMainFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { /* TODO better error handling? May cause problems when a key is deleted, * because the notification triggers faster than the activity closes. */// w ww. java2 s .c o m // Avoid NullPointerExceptions... if (data.getCount() == 0) { return; } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { case LOADER_ID_UNIFIED: { if (data.moveToFirst()) { if (data.getInt(INDEX_UNIFIED_HAS_ANY_SECRET) != 0) { // certify button mActionCertify.setVisibility(View.GONE); mActionCertifyDivider.setVisibility(View.GONE); // edit button mActionEdit.setVisibility(View.VISIBLE); mActionEditDivider.setVisibility(View.VISIBLE); } else { // certify button mActionCertify.setVisibility(View.VISIBLE); mActionCertifyDivider.setVisibility(View.VISIBLE); // edit button mActionEdit.setVisibility(View.GONE); mActionEditDivider.setVisibility(View.GONE); } // If this key is revoked, it cannot be used for anything! if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) { mActionEdit.setEnabled(false); mActionCertify.setEnabled(false); mActionEncrypt.setEnabled(false); } else { mActionEdit.setEnabled(true); Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000); if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) { mActionCertify.setEnabled(false); mActionEncrypt.setEnabled(false); } else { mActionCertify.setEnabled(true); mActionEncrypt.setEnabled(true); } } mHasEncrypt = data.getInt(INDEX_UNIFIED_HAS_ENCRYPT) != 0; break; } } case LOADER_ID_USER_IDS: mUserIdsAdapter.swapCursor(data); break; } setContentShown(true); }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvShareFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Avoid NullPointerExceptions... if (data == null || data.getCount() == 0) { return;/*from ww w.ja va 2 s . c o m*/ } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { case LOADER_ID_UNIFIED: { if (data.moveToFirst()) { byte[] fingerprintBlob = data.getBlob(INDEX_UNIFIED_FINGERPRINT); setFingerprint(fingerprintBlob); mUserId = data.getString(INDEX_UNIFIED_USER_ID); break; } } } setContentShown(true); }