Java Code Examples for androidx.loader.content.Loader#getId()
The following examples show how to use
androidx.loader.content.Loader#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaybackFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (cursor == null || !cursor.moveToFirst()) { return; } int id = loader.getId(); if (id == QUEUE_VIDEOS_LOADER) { playlist.clear(); do { Video video = (Video) mVideoCursorMapper.convert(cursor); // Set the current position to the selected video. if (video.id == mVideo.id) { playlist.setCurrentPosition(playlist.size()); } playlist.add(video); } while (cursor.moveToNext()); } else if (id == RELATED_VIDEOS_LOADER) { mVideoCursorAdapter.changeCursor(cursor); } }
Example 2
Source File: VideoDetailsFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (cursor != null && cursor.moveToNext()) { switch (loader.getId()) { case RELATED_VIDEO_LOADER: { mVideoCursorAdapter.changeCursor(cursor); break; } default: { // Loading video from global search. mSelectedVideo = (Video) mVideoCursorMapper.convert(cursor); setupAdapter(); setupDetailsOverviewRow(); setupMovieListRow(); updateBackground(mSelectedVideo.bgImageUrl); // When a Related Video item is clicked. setOnItemViewClickedListener(new ItemViewClickedListener()); } } } }
Example 3
Source File: ChannelFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // This swaps the new cursor into the adapter. if (loader.getId() == QUERY_ID) { mAdapter.swapCursor(data); } }
Example 4
Source File: MainFragment.java From tv-samples with Apache License 2.0 | 5 votes |
@Override public void onLoaderReset(Loader<Cursor> loader) { int loaderId = loader.getId(); if (loaderId != CATEGORY_LOADER) { mVideoCursorAdapters.get(loaderId).changeCursor(null); } else { mCategoryRowAdapter.clear(); } }
Example 5
Source File: TVShowProgressFragment.java From Kore with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null) { switch (loader.getId()) { case LOADER_NEXT_EPISODES: displayNextEpisodeList(data); break; case LOADER_SEASONS: displaySeasonList(data); break; } } }
Example 6
Source File: ContactSelectionFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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); } }
Example 7
Source File: AlbumInfoFragment.java From Kore with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_ALBUM: cursor.moveToFirst(); DataHolder dataHolder = getDataHolder(); dataHolder.setRating(cursor.getDouble(AlbumDetailsQuery.RATING)); dataHolder.setTitle(cursor.getString(AlbumDetailsQuery.TITLE)); dataHolder.setUndertitle(cursor.getString(AlbumDetailsQuery.DISPLAYARTIST)); dataHolder.setDescription(cursor.getString(AlbumDetailsQuery.DESCRIPTION)); dataHolder.setFanArtUrl(cursor.getString(AlbumInfoFragment.AlbumDetailsQuery.FANART)); dataHolder.setPosterUrl(cursor.getString(AlbumInfoFragment.AlbumDetailsQuery.THUMBNAIL)); int year = cursor.getInt(AlbumDetailsQuery.YEAR); String genres = cursor.getString(AlbumDetailsQuery.GENRE); dataHolder.setDetails ( (year > 0) ? (!TextUtils.isEmpty(genres) ? genres + " | " + String.valueOf(year) : String.valueOf(year)) : genres ); FileDownloadHelper.SongInfo songInfo = new FileDownloadHelper.SongInfo (dataHolder.getUnderTitle(), dataHolder.getTitle(), 0, 0, null, null); setDownloadButtonState(songInfo.downloadDirectoryExists()); updateView(dataHolder); break; } } }
Example 8
Source File: MusicVideoInfoFragment.java From Kore with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_MUSIC_VIDEO: this.cursor = cursor; cursor.moveToFirst(); DataHolder dataHolder = getDataHolder(); dataHolder.setFanArtUrl(cursor.getString(MusicVideoDetailsQuery.FANART)); dataHolder.setPosterUrl(cursor.getString(MusicVideoDetailsQuery.THUMBNAIL)); int runtime = cursor.getInt(MusicVideoDetailsQuery.RUNTIME); int year = cursor.getInt(MusicVideoDetailsQuery.YEAR); String details = runtime > 0 ? UIUtils.formatTime(runtime) + " | " + String.valueOf(year) : String.valueOf(year); dataHolder.setDetails(details + "\n" + cursor.getString(MusicVideoDetailsQuery.GENRES)); dataHolder.setTitle(cursor.getString(MusicVideoDetailsQuery.TITLE)); dataHolder.setUndertitle(cursor.getString(MusicVideoDetailsQuery.ARTIST) + " | " + cursor.getString(MusicVideoDetailsQuery.ALBUM)); dataHolder.setDescription(cursor.getString(MusicVideoDetailsQuery.PLOT)); FileDownloadHelper.MusicVideoInfo musicVideoDownloadInfo = new FileDownloadHelper.MusicVideoInfo( dataHolder.getTitle(), cursor.getString(MusicVideoDetailsQuery.FILE)); setDownloadButtonState(musicVideoDownloadInfo.downloadFileExists()); updateView(dataHolder); break; } } }
Example 9
Source File: ArtistInfoFragment.java From Kore with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_ARTIST: cursor.moveToFirst(); FileDownloadHelper.SongInfo songInfo = new FileDownloadHelper.SongInfo( cursor.getString(DetailsQuery.ARTIST),null, -1, -1, null, null); setDownloadButtonState(songInfo.downloadDirectoryExists()); DataHolder dataHolder = getDataHolder(); dataHolder.setTitle(cursor.getString(DetailsQuery.ARTIST)); dataHolder.setUndertitle(cursor.getString(DetailsQuery.GENRE)); dataHolder.setDescription(cursor.getString(DetailsQuery.DESCRIPTION)); dataHolder.setPosterUrl(cursor.getString(DetailsQuery.THUMBNAIL)); dataHolder.setFanArtUrl(cursor.getString(DetailsQuery.FANART)); updateView(dataHolder); break; case LOADER_SONGS: final ArrayList<FileDownloadHelper.SongInfo> songInfoList = new ArrayList<>(cursor.getCount()); if (cursor.moveToFirst()) { do { songInfoList.add(createSongInfo(cursor)); } while (cursor.moveToNext()); } UIUtils.downloadSongs(getActivity(), songInfoList, getHostInfo(), callbackHandler); } } }
Example 10
Source File: AppContactFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onLoaderReset(Loader<Cursor> loader) { if (loader.getId() == ContactsQuery.QUERY_ID) { // When the loader is being reset, clear the cursor from the adapter. This allows the // cursor resources to be freed. mAdapter.swapCursor(null); } }
Example 11
Source File: MessagesAdapter.java From tindroid with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor) { if (loader.getId() == MESSAGES_QUERY_ID) { swapCursor(cursor, mHardReset ? REFRESH_HARD : REFRESH_SOFT); } }
Example 12
Source File: ContactsLoaderCallback.java From tindroid with Apache License 2.0 | 5 votes |
@Override public void onLoaderReset(@NonNull Loader<Cursor> loader) { if (loader.getId() == mID) { // When the loader is being reset, clear the cursor from the adapter. This allows the // cursor resources to be freed. mAdapter.swapCursor(null, mSearchTerm); } }
Example 13
Source File: ContactsLoaderCallback.java From tindroid with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) { // This swaps the new cursor into the adapter. if (loader.getId() == mID) { mAdapter.swapCursor(data, mSearchTerm); } }
Example 14
Source File: DynamicPresetsView.java From dynamic-support with Apache License 2.0 | 5 votes |
@Override public void onLoaderReset(@NonNull Loader<Cursor> loader) { if (loader.getId() == ADS_LOADER_PRESETS) { mPresetsAdapter.setPresets(null); setPresetsVisible(false); } }
Example 15
Source File: ChannelFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onLoaderReset(Loader<Cursor> loader) { if (loader.getId() == QUERY_ID) { // When the loader is being reset, clear the cursor from the adapter. This allows the // cursor resources to be freed. mAdapter.swapCursor(null); } }
Example 16
Source File: AppContactFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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); } }
Example 17
Source File: ContactSelectionFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onLoaderReset(Loader<Cursor> loader) { if (loader.getId() == ContactsQuery.QUERY_ID) { // When the loader is being reset, clear the cursor from the adapter. This allows the // cursor resources to be freed. mAdapter.swapCursor(null); } }
Example 18
Source File: TVShowEpisodeInfoFragment.java From Kore with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_EPISODE: cursor.moveToFirst(); this.cursor = cursor; DataHolder dataHolder = getDataHolder(); dataHolder.setPosterUrl(cursor.getString(EpisodeDetailsQuery.THUMBNAIL)); dataHolder.setRating(cursor.getDouble(EpisodeDetailsQuery.RATING)); dataHolder.setMaxRating(10); String director = cursor.getString(EpisodeDetailsQuery.DIRECTOR); if (!TextUtils.isEmpty(director)) { director = getActivity().getResources().getString(R.string.directors) + " " + director; } int runtime = cursor.getInt(EpisodeDetailsQuery.RUNTIME) / 60; String durationPremiered = runtime > 0 ? String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) + " | " + cursor.getString(EpisodeDetailsQuery.FIRSTAIRED) : cursor.getString(EpisodeDetailsQuery.FIRSTAIRED); String season = String.format(getString(R.string.season_episode), cursor.getInt(EpisodeDetailsQuery.SEASON), cursor.getInt(EpisodeDetailsQuery.EPISODE)); dataHolder.setDetails(durationPremiered + "\n" + season + "\n" + director); fileDownloadHelper = new FileDownloadHelper.TVShowInfo( cursor.getString(EpisodeDetailsQuery.SHOWTITLE), cursor.getInt(EpisodeDetailsQuery.SEASON), cursor.getInt(EpisodeDetailsQuery.EPISODE), cursor.getString(EpisodeDetailsQuery.TITLE), cursor.getString(EpisodeDetailsQuery.FILE)); setDownloadButtonState(fileDownloadHelper.downloadFileExists()); setSeenButtonState(cursor.getInt(EpisodeDetailsQuery.PLAYCOUNT) > 0); getDataHolder().setTitle(cursor.getString(EpisodeDetailsQuery.TITLE)); getDataHolder().setUndertitle(cursor.getString(EpisodeDetailsQuery.SHOWTITLE)); setExpandDescription(true); getDataHolder().setDescription(cursor.getString(EpisodeDetailsQuery.PLOT)); updateView(dataHolder); break; } } getFabButton().enableLocalPlay(fileDownloadHelper != null); }
Example 19
Source File: MovieInfoFragment.java From Kore with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor != null && cursor.getCount() > 0) { switch (cursorLoader.getId()) { case LOADER_MOVIE: cursor.moveToFirst(); this.cursor = cursor; DataHolder dataHolder = getDataHolder(); dataHolder.setFanArtUrl(cursor.getString(MovieDetailsQuery.FANART)); dataHolder.setPosterUrl(cursor.getString(MovieDetailsQuery.THUMBNAIL)); dataHolder.setRating(cursor.getDouble(MovieDetailsQuery.RATING)); dataHolder.setMaxRating(10); dataHolder.setVotes(cursor.getInt(MovieDetailsQuery.VOTES)); String director = cursor.getString(MovieDetailsQuery.DIRECTOR); if (!TextUtils.isEmpty(director)) { director = getString(R.string.directors) + " " + director; } int runtime = cursor.getInt(MovieDetailsQuery.RUNTIME) / 60; String year = String.valueOf(cursor.getInt(MovieDetailsQuery.YEAR)); String durationYear = runtime > 0 ? String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) + " | " + year : String.valueOf(year); dataHolder.setDetails(durationYear + "\n" + cursor.getString(MovieDetailsQuery.GENRES) +"\n" + director); dataHolder.setTitle(cursor.getString(MovieDetailsQuery.TITLE)); dataHolder.setUndertitle(cursor.getString(MovieDetailsQuery.TAGLINE)); dataHolder.setDescription(cursor.getString(MovieDetailsQuery.PLOT)); movieDownloadInfo = new FileDownloadHelper.MovieInfo( dataHolder.getTitle(), cursor.getString(MovieDetailsQuery.FILE)); setDownloadButtonState(movieDownloadInfo.downloadDirectoryExists()); setSeenButtonState(cursor.getInt(MovieDetailsQuery.PLAYCOUNT) > 0); updateView(dataHolder); checkOutdatedMovieDetails(cursor); break; } } getFabButton().enableLocalPlay(movieDownloadInfo != null); }
Example 20
Source File: VerticalGridFragment.java From tv-samples with Apache License 2.0 | 4 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (loader.getId() == ALL_VIDEOS_LOADER && cursor != null && cursor.moveToFirst()) { mVideoCursorAdapter.changeCursor(cursor); } }