List of usage examples for android.content Loader getId
public int getId()
From source file:koma.movieapp.ui.MoviesFragment.java
@Override public void onLoadFinished(Loader<ArrayList<Movie>> loader, ArrayList<Movie> data) { if (getActivity() == null) { return;/* www . ja v a 2 s . co m*/ } int token = loader.getId(); LOGD(TAG, "Loader finished: " + (token == Config.NOW_PLAYING_TOKEN ? "now playing" : token == Config.UPCOMING_TOKEN ? "upcoming" : token == Config.POPULAR_TOKEN ? "popular" : token == Config.SEARCH_TOKEN ? "search" : "unknown")); mMovieList = data; LOGD(TAG, "Will now update collection view."); updateCollectionView(); }
From source file:com.ncode.android.apps.schedo.ui.EventsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null) { return;/*from w w w.ja va 2 s . c om*/ } int token = loader.getId(); LOGD(TAG, "Loader finished: " + (token == EventsQuery.NORMAL_TOKEN ? "events" : token == EventsQuery.SEARCH_TOKEN ? "search" : token == TAG_METADATA_TOKEN ? "tags" : "unknown")); if (token == EventsQuery.NORMAL_TOKEN || token == EventsQuery.SEARCH_TOKEN) { if (mCursor != null && mCursor != cursor) { mCursor.close(); } mCursor = cursor; mIsSearchCursor = token == EventsQuery.SEARCH_TOKEN; LOGD(TAG, "Cursor has " + mCursor.getCount() + " items. Will now update collection view."); updateCollectionView(); } else if (token == TAG_METADATA_TOKEN) { mTagMetadata = new TagMetadata(cursor); cursor.close(); updateCollectionView(); mCallbacks.onTagMetadataLoaded(mTagMetadata); } else { LOGD(TAG, "Query complete, Not Actionable: " + token); cursor.close(); } }
From source file:com.google.samples.apps.iosched.ui.SessionsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null) { return;/* w w w . ja va2 s . co m*/ } int token = loader.getId(); LOGD(TAG, "Loader finished: " + (token == SessionsQuery.NORMAL_TOKEN ? "sessions" : token == SessionsQuery.SEARCH_TOKEN ? "search" : token == TAG_METADATA_TOKEN ? "tags" : "unknown")); if (token == SessionsQuery.NORMAL_TOKEN || token == SessionsQuery.SEARCH_TOKEN) { if (mCursor != null && mCursor != cursor) { mCursor.close(); } mCursor = cursor; mIsSearchCursor = token == SessionsQuery.SEARCH_TOKEN; LOGD(TAG, "Cursor has " + mCursor.getCount() + " items. Will now update collection view."); updateCollectionView(); } else if (token == TAG_METADATA_TOKEN) { mTagMetadata = new TagMetadata(cursor); cursor.close(); updateCollectionView(); mCallbacks.onTagMetadataLoaded(mTagMetadata); } else { LOGD(TAG, "Query complete, Not Actionable: " + token); cursor.close(); } }
From source file:xyz.template.material.menu.ui.fragment.SessionsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null || cursor == null) { return;/*from w ww . j a v a2 s. c o m*/ } int token = loader.getId(); LOGD(TAG, "Loader finished: " + (token == SessionsQuery.NORMAL_TOKEN ? "sessions" : token == SessionsQuery.SEARCH_TOKEN ? "search" : token == TAG_METADATA_TOKEN ? "tags" : "unknown")); if (token == SessionsQuery.NORMAL_TOKEN || token == SessionsQuery.SEARCH_TOKEN) { if (mCursor != null && mCursor != cursor) { mCursor.close(); } mCursor = cursor; mIsSearchCursor = token == SessionsQuery.SEARCH_TOKEN; LOGD(TAG, "Cursor has " + mCursor.getCount() + " items. Will now update collection view."); updateCollectionView(); } else if (token == TAG_METADATA_TOKEN) { mTagMetadata = new TagMetadata(cursor); cursor.close(); updateCollectionView(); mCallbacks.onTagMetadataLoaded(mTagMetadata); } else { LOGD(TAG, "Query complete, Not Actionable: " + token); cursor.close(); } }
From source file:com.ptapp.activity.SessionsFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null) { return;/*from ww w .ja v a 2 s . c om*/ } int token = loader.getId(); LOGD(TAG, "Loader finished: " + (token == SessionsQuery.NORMAL_TOKEN ? "educator" : token == SessionsQuery.SEARCH_TOKEN ? "search" : "")); if (token == SessionsQuery.NORMAL_TOKEN || token == SessionsQuery.SEARCH_TOKEN) { if (mCursor != null && mCursor != cursor) { mCursor.close(); } mCursor = cursor; mIsSearchCursor = token == SessionsQuery.SEARCH_TOKEN; LOGD(TAG, "Cursor has " + mCursor.getCount() + " items. Will now update collection view."); updateCollectionView(); } else { LOGD(TAG, "Query complete, Not Actionable: " + token); cursor.close(); } }
From source file:com.android.contacts.list.DefaultContactBrowseListFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (loader.getId() == Directory.DEFAULT) { bindListHeader(data == null ? 0 : data.getCount()); }//www . j av a2s. com super.onLoadFinished(loader, data); if (!isSearchMode()) { maybeShowHamburgerFeatureHighlight(); } if (mActionBarAdapter != null) { mActionBarAdapter.updateOverflowButtonColor(); } }
From source file:com.chen.mail.ui.FolderListFragment.java
@Override public void onLoaderReset(Loader<ObjectCursor<Folder>> loader) { if (mCursorAdapter != null) { if (loader.getId() == FOLDER_LIST_LOADER_ID) { mCursorAdapter.setCursor(null); } else if (loader.getId() == ALL_FOLDER_LIST_LOADER_ID) { mCursorAdapter.setAllFolderListCursor(null); }// w w w . j a v a 2s . co m } }
From source file:com.frostwire.android.gui.fragments.MyFilesFragment.java
@Override public void onLoadFinished(Loader<Object> loader, Object dataObj) { Object[] data = (Object[]) dataObj; if (data == null || data.length < 2 || data[1] == null) { LOG.warn("Something wrong, data is null"); return;//from w w w .jav a 2 s . c o m } byte fileType = (Byte) data[0]; if (fileType != lastFileType) { // user already pressed another tab return; } if (loader.getId() == LOADER_FILES_ID) { updateFiles(data); } updateHeader(); if (swipeRefresh != null) { swipeRefresh.setRefreshing(false); } }
From source file:com.chen.mail.ui.FolderListFragment.java
@Override public void onLoadFinished(Loader<ObjectCursor<Folder>> loader, ObjectCursor<Folder> data) { if (mCursorAdapter != null) { if (loader.getId() == FOLDER_LIST_LOADER_ID) { mCursorAdapter.setCursor(data); } else if (loader.getId() == ALL_FOLDER_LIST_LOADER_ID) { mCursorAdapter.setAllFolderListCursor(data); }/*from w w w. j a v a 2s .c o m*/ } }
From source file:com.aengbee.android.leanback.ui.PlaybackOverlayCustomFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (cursor != null && cursor.moveToFirst()) { switch (loader.getId()) { case QUEUE_VIDEOS_LOADER: { mQueue.clear();/* w w w . ja v a 2s . c o m*/ while (!cursor.isAfterLast()) { Video v = (Video) mVideoCursorMapper.convert(cursor); // Set the queue index to the selected video. if (v.id == mSelectedVideo.id) { mQueueIndex = mQueue.size(); } // Add the video to the queue. MediaSessionCompat.QueueItem item = getQueueItem(v); mQueue.add(item); cursor.moveToNext(); } mSession.setQueue(mQueue); mSession.setQueueTitle(getString(R.string.queue_name)); break; } case RECOMMENDED_VIDEOS_LOADER: { mVideoCursorAdapter.changeCursor(cursor); break; } case 0: { /* int titleRes; if (cursor != null && cursor.moveToFirst()) { mResultsFound = true; titleRes = R.string.search_results; } else { mResultsFound = false; titleRes = R.string.no_search_results; } mVideoCursorAdapter.changeCursor(cursor); HeaderItem header = new HeaderItem(getString(titleRes, mQuery)); mRowsAdapter.clear(); ListRow row = new ListRow(header, mVideoCursorAdapter); mRowsAdapter.add(row); setAdapter(mRowsAdapter); break; */ // Playing a specific video. Video video = (Video) mVideoCursorMapper.convert(cursor); playVideo(video, mAutoPlayExtras); break; } default: { mVideoCursorAdapter.changeCursor(cursor); break; } } } }