-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load all similar movies and tv shows from detail screen
- Loading branch information
Showing
30 changed files
with
241 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
core/data/src/main/java/com/sample/tmdb/data/paging/movie/SimilarMoviesPagingSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.sample.tmdb.data.paging.movie | ||
|
||
import android.content.Context | ||
import com.sample.tmdb.data.network.MovieService | ||
import com.sample.tmdb.data.response.asMovieDomainModel | ||
import com.sample.tmdb.domain.model.Movie | ||
import com.sample.tmdb.domain.paging.BasePagingSource | ||
|
||
class SimilarMoviesPagingSource( | ||
context: Context, | ||
private val movieApi: MovieService, | ||
private val movieId: Int | ||
) : BasePagingSource<Movie>(context) { | ||
|
||
override suspend fun fetchItems(page: Int): List<Movie> = | ||
movieApi.fetchSimilarMovies(movieId, page).items.asMovieDomainModel() | ||
} |
17 changes: 17 additions & 0 deletions
17
core/data/src/main/java/com/sample/tmdb/data/paging/tvshow/SimilarTvSeriesPagingSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.sample.tmdb.data.paging.tvshow | ||
|
||
import android.content.Context | ||
import com.sample.tmdb.data.network.TVShowService | ||
import com.sample.tmdb.data.response.asTVShowDomainModel | ||
import com.sample.tmdb.domain.model.TVShow | ||
import com.sample.tmdb.domain.paging.BasePagingSource | ||
|
||
class SimilarTvSeriesPagingSource( | ||
context: Context, | ||
private val tvShowApi: TVShowService, | ||
private val tvId: Int | ||
) : BasePagingSource<TVShow>(context) { | ||
|
||
override suspend fun fetchItems(page: Int): List<TVShow> = | ||
tvShowApi.fetchSimilarMovies(tvId, page).items.asTVShowDomainModel() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
core/data/src/main/java/com/sample/tmdb/data/repository/SimilarMoviesPagingRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.sample.tmdb.data.repository | ||
|
||
import android.content.Context | ||
import com.sample.tmdb.data.network.MovieService | ||
import com.sample.tmdb.data.paging.movie.SimilarMoviesPagingSource | ||
import com.sample.tmdb.domain.model.Movie | ||
import com.sample.tmdb.domain.paging.BasePagingSource | ||
import com.sample.tmdb.domain.repository.BasePagingRepository | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class SimilarMoviesPagingRepository @Inject constructor( | ||
@ApplicationContext private val context: Context, | ||
private val movieApi: MovieService | ||
) : BasePagingRepository<Movie>() { | ||
|
||
override fun pagingSource(query: String?, id: Int?): BasePagingSource<Movie> = | ||
SimilarMoviesPagingSource(context, movieApi, id!!) | ||
} |
21 changes: 21 additions & 0 deletions
21
core/data/src/main/java/com/sample/tmdb/data/repository/SimilarTvSeriesPagingRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.sample.tmdb.data.repository | ||
|
||
import android.content.Context | ||
import com.sample.tmdb.data.network.TVShowService | ||
import com.sample.tmdb.data.paging.tvshow.SimilarTvSeriesPagingSource | ||
import com.sample.tmdb.domain.model.TVShow | ||
import com.sample.tmdb.domain.paging.BasePagingSource | ||
import com.sample.tmdb.domain.repository.BasePagingRepository | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class SimilarTvSeriesPagingRepository @Inject constructor( | ||
@ApplicationContext private val context: Context, | ||
private val tvShowApi: TVShowService | ||
) : BasePagingRepository<TVShow>() { | ||
|
||
override fun pagingSource(query: String?, id: Int?): BasePagingSource<TVShow> = | ||
SimilarTvSeriesPagingSource(context, tvShowApi, id!!) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.