diff --git a/app/src/androidTest/java/com/faprayyy/tonton/MainActivityTest.kt b/app/src/androidTest/java/com/faprayyy/tonton/MainActivityTest.kt
index ebc031e..ac91497 100644
--- a/app/src/androidTest/java/com/faprayyy/tonton/MainActivityTest.kt
+++ b/app/src/androidTest/java/com/faprayyy/tonton/MainActivityTest.kt
@@ -13,12 +13,12 @@ import com.faprayyy.tonton.data.remote.response.MovieDetail
import com.faprayyy.tonton.data.remote.response.MovieModel
import com.faprayyy.tonton.data.remote.response.SeriesDetail
import com.faprayyy.tonton.data.remote.response.SeriesModel
+import com.faprayyy.tonton.utils.Converter.convertGenres
import com.faprayyy.tonton.utils.DataDummy.generateDetailMovie
import com.faprayyy.tonton.utils.DataDummy.generateDetailSeries
import com.faprayyy.tonton.utils.DataDummy.generateMoviesList
import com.faprayyy.tonton.utils.DataDummy.generateSeriesList
import com.faprayyy.tonton.utils.EspressoIdlingResource
-import com.faprayyy.tonton.utils.convertGenres
import com.faprayyy.tonton.view.ui.main.MainActivity
import org.junit.After
import org.junit.Before
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bf1941d..01269aa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,8 +11,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Tonton">
-
-
+
diff --git a/app/src/main/java/com/faprayyy/tonton/data/NetworkBoundResource.kt b/app/src/main/java/com/faprayyy/tonton/data/NetworkBoundResource.kt
index 9ce26b8..6d91010 100644
--- a/app/src/main/java/com/faprayyy/tonton/data/NetworkBoundResource.kt
+++ b/app/src/main/java/com/faprayyy/tonton/data/NetworkBoundResource.kt
@@ -22,8 +22,8 @@ abstract class NetworkBoundResource(private val executo
if (shouldFecth(data)){
fetchFromNetwork(dbSource)
}else{
- resultData.addSource( dbSource ){ data ->
- resultData.value = Resource.success( data )
+ resultData.addSource( dbSource ){
+ resultData.value = Resource.success( it )
}
}
}
@@ -73,6 +73,7 @@ abstract class NetworkBoundResource(private val executo
resultData.value = Resource.error(data.message, newData)
}
}
+ else -> { }
}
}
}
diff --git a/app/src/main/java/com/faprayyy/tonton/data/remote/response/MovieDetailResponse.kt b/app/src/main/java/com/faprayyy/tonton/data/remote/response/MovieDetailResponse.kt
deleted file mode 100644
index 13902ec..0000000
--- a/app/src/main/java/com/faprayyy/tonton/data/remote/response/MovieDetailResponse.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.faprayyy.tonton.data.remote.response
-
-import com.google.gson.annotations.Expose
-import com.google.gson.annotations.SerializedName
-
-data class MovieDetailResponse(
- @SerializedName("results")
- @Expose
- var results: ArrayList = ArrayList(),
-)
\ No newline at end of file
diff --git a/app/src/main/java/com/faprayyy/tonton/data/remote/response/SeriesDetailResponse.kt b/app/src/main/java/com/faprayyy/tonton/data/remote/response/SeriesDetailResponse.kt
deleted file mode 100644
index 49d6820..0000000
--- a/app/src/main/java/com/faprayyy/tonton/data/remote/response/SeriesDetailResponse.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.faprayyy.tonton.data.remote.response
-
-import com.google.gson.annotations.Expose
-import com.google.gson.annotations.SerializedName
-
-data class SeriesDetailResponse(
- @SerializedName("results")
- @Expose
- var results: ArrayList = ArrayList(),
-)
\ No newline at end of file
diff --git a/app/src/main/java/com/faprayyy/tonton/di/AppModule.kt b/app/src/main/java/com/faprayyy/tonton/di/AppModule.kt
index 204edcc..108481c 100644
--- a/app/src/main/java/com/faprayyy/tonton/di/AppModule.kt
+++ b/app/src/main/java/com/faprayyy/tonton/di/AppModule.kt
@@ -55,9 +55,9 @@ object AppModule {
@Provides
@Singleton
fun provideRemoteDataSource(
- herbifyDao: MuviDao
+ apiService: ApiService
) : RemoteDataSource {
- return RemoteDataSource(provideApiService())
+ return RemoteDataSource(apiService)
}
@Provides
diff --git a/app/src/main/java/com/faprayyy/tonton/di/Injection.kt b/app/src/main/java/com/faprayyy/tonton/di/Injection.kt
deleted file mode 100644
index 0460ee6..0000000
--- a/app/src/main/java/com/faprayyy/tonton/di/Injection.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.faprayyy.tonton.di
-
-import android.content.Context
-import com.faprayyy.tonton.data.MuviDBRepository
-import com.faprayyy.tonton.data.local.LocalDataSource
-import com.faprayyy.tonton.data.local.db.MuviDatabase
-import com.faprayyy.tonton.data.remote.ApiConfig
-import java.util.concurrent.ExecutorService
-import java.util.concurrent.Executors
-
-object Injection {
-//
-// fun provideRepository(context: Context): MuviDBRepository {
-//
-// val database = MuviDatabase.getDatabase(context)
-//
-// val apiService = ApiConfig.getApiService()
-// val localDataSource = LocalDataSource.getInstance(database.favoriteDao())
-//
-// val executorService: ExecutorService = Executors.newSingleThreadExecutor()
-//
-// return MuviDBRepository.getInstance(apiService, localDataSource, executorService)
-// }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/faprayyy/tonton/utils/AppExecutors.kt b/app/src/main/java/com/faprayyy/tonton/utils/AppExecutors.kt
index 3cc1ba9..91a20cd 100644
--- a/app/src/main/java/com/faprayyy/tonton/utils/AppExecutors.kt
+++ b/app/src/main/java/com/faprayyy/tonton/utils/AppExecutors.kt
@@ -8,24 +8,16 @@ import java.util.concurrent.Executors
class AppExecutors @VisibleForTesting constructor(
private val diskIO: Executor,
- private val networkIO: Executor,
private val mainThread: Executor
) {
- companion object {
- private const val THREAD_COUNT = 3
- }
-
constructor() : this(
Executors.newSingleThreadExecutor(),
- Executors.newFixedThreadPool(THREAD_COUNT),
MainThreadExecutor()
)
fun diskIO(): Executor = diskIO
- fun networkIO(): Executor = networkIO
-
fun mainThread(): Executor = mainThread
private class MainThreadExecutor : Executor {
diff --git a/app/src/main/java/com/faprayyy/tonton/utils/DataDummy.kt b/app/src/main/java/com/faprayyy/tonton/utils/DataDummy.kt
index 2ad5de9..02ae591 100644
--- a/app/src/main/java/com/faprayyy/tonton/utils/DataDummy.kt
+++ b/app/src/main/java/com/faprayyy/tonton/utils/DataDummy.kt
@@ -9,7 +9,7 @@ import com.faprayyy.tonton.view.ui.detail.detailseries.DetailSeriesActivity.Comp
import com.google.gson.Gson
object DataDummy{
- const val stringListMovieResponse = "{\"page\":1,\"results\":[" +
+ private const val stringListMovieResponse = "{\"page\":1,\"results\":[" +
"{\"adult\":false,\"backdrop_path\":\"/fPGeS6jgdLovQAKunNHX8l0avCy.jpg\",\"genre_ids\":[28,12,53,10752],\"id\":567189,\"original_language\":\"en\",\"original_title\":\"Tom Clancy's Without Remorse\",\"overview\":\"An elite Navy SEAL uncovers an international conspiracy while seeking justice for the murder of his pregnant wife.\",\"popularity\":3143.69,\"poster_path\":\"/rEm96ib0sPiZBADNKBHKBv5bve9.jpg\",\"release_date\":\"2021-04-29\",\"title\":\"Tom Clancy's Without Remorse\",\"video\":false,\"vote_average\":7.3,\"vote_count\":876}," +
"{\"adult\":false,\"backdrop_path\":\"/6ELCZlTA5lGUops70hKdB83WJxH.jpg\",\"genre_ids\":[28,14,12],\"id\":460465,\"original_language\":\"en\",\"original_title\":\"Mortal Kombat\",\"overview\":\"Washed-up MMA fighter Cole Young, unaware of his heritage, and hunted by Emperor Shang Tsung's best warrior, Sub-Zero, seeks out and trains with Earth's greatest champions as he prepares to stand against the enemies of Outworld in a high stakes battle for the universe.\",\"popularity\":2681.013,\"poster_path\":\"/nkayOAUBUu4mMvyNf9iHSUiPjF1.jpg\",\"release_date\":\"2021-04-07\",\"title\":\"Mortal Kombat\",\"video\":false,\"vote_average\":7.6,\"vote_count\":2482}," +
"{\"adult\":false,\"backdrop_path\":\"/6zbKgwgaaCyyBXE4Sun4oWQfQmi.jpg\",\"genre_ids\":[28,53,80,35],\"id\":615457,\"original_language\":\"en\",\"original_title\":\"Nobody\",\"overview\":\"Hutch Mansell, a suburban dad, overlooked husband, nothing neighbor — a \\\"nobody.\\\" When two thieves break into his home one night, Hutch's unknown long-simmering rage is ignited and propels him on a brutal path that will uncover dark secrets he fought to leave behind.\",\"popularity\":1602.076,\"poster_path\":\"/oBgWY00bEFeZ9N25wWVyuQddbAo.jpg\",\"release_date\":\"2021-03-26\",\"title\":\"Nobody\",\"video\":false,\"vote_average\":8.4,\"vote_count\":1483}," +
@@ -53,9 +53,9 @@ object DataDummy{
"{\"backdrop_path\":\"/pLG4ihU1d2XkQbASQDjsFu9U7d9.jpg\",\"first_air_date\":\"2021-03-24\",\"genre_ids\":[18,80,9648],\"id\":120168,\"name\":\"Who Killed Sara?\",\"origin_country\":[\"MX\"],\"original_language\":\"es\",\"original_name\":\"¿Quién mató a Sara?\",\"overview\":\"Hell-bent on exacting revenge and proving he was framed for his sister's murder, Álex sets out to unearth much more than the crime's real culprit.\",\"popularity\":397.662,\"poster_path\":\"/o7uk5ChRt3quPIv8PcvPfzyXdMw.jpg\",\"vote_average\":7.8,\"vote_count\":495}," +
"{\"backdrop_path\":\"/fRYwdeNjMqC30EhofPx5PlDpdun.jpg\",\"first_air_date\":\"2018-10-25\",\"genre_ids\":[10765,18],\"id\":79460,\"name\":\"Legacies\",\"origin_country\":[\"US\"],\"original_language\":\"en\",\"original_name\":\"Legacies\",\"overview\":\"In a place where young witches, vampires, and werewolves are nurtured to be their best selves in spite of their worst impulses, Klaus Mikaelson’s daughter, 17-year-old Hope Mikaelson, Alaric Saltzman’s twins, Lizzie and Josie Saltzman, among others, come of age into heroes and villains at The Salvatore School for the Young and Gifted.\",\"popularity\":388.79,\"poster_path\":\"/qTZIgXrBKURBK1KrsT7fe3qwtl9.jpg\",\"vote_average\":8.6,\"vote_count\":1865}],\"total_pages\":500,\"total_results\":10000}"
- const val stringDetailMovieResponse = "{\"adult\":false,\"backdrop_path\":\"/fPGeS6jgdLovQAKunNHX8l0avCy.jpg\",\"belongs_to_collection\":null,\"budget\":0,\"genres\":[{\"id\":28,\"name\":\"Action\"},{\"id\":53,\"name\":\"Thriller\"},{\"id\":10752,\"name\":\"War\"}],\"homepage\":\"https://www.amazon.com/dp/B08VFD1Y3B\",\"id\":567189,\"imdb_id\":\"tt0499097\",\"original_language\":\"en\",\"original_title\":\"Tom Clancy's Without Remorse\",\"overview\":\"An elite Navy SEAL uncovers an international conspiracy while seeking justice for the murder of his pregnant wife.\",\"popularity\":3143.69,\"poster_path\":\"/rEm96ib0sPiZBADNKBHKBv5bve9.jpg\",\"production_companies\":[{\"id\":4,\"logo_path\":\"/fycMZt242LVjagMByZOLUGbCvv3.png\",\"name\":\"Paramount\",\"origin_country\":\"US\"},{\"id\":433,\"logo_path\":null,\"name\":\"Weed Road Pictures\",\"origin_country\":\"US\"},{\"id\":82819,\"logo_path\":\"/5Z8WWr0Lf1tInVWwJsxPP0uMz9a.png\",\"name\":\"Skydance Media\",\"origin_country\":\"US\"},{\"id\":51593,\"logo_path\":null,\"name\":\"Midnight Radio\",\"origin_country\":\"US\"},{\"id\":102334,\"logo_path\":\"/espa8KYmHedu5p7GRrP9FFICLUp.png\",\"name\":\"Outlier Society Productions\",\"origin_country\":\"US\"},{\"id\":114732,\"logo_path\":\"/tNCbisMxO5mX2X2bOQxHHQZVYnT.png\",\"name\":\"New Republic Pictures\",\"origin_country\":\"US\"},{\"id\":20580,\"logo_path\":\"/tkFE81jJIqiFYPP8Tho57MXRQEx.png\",\"name\":\"Amazon Studios\",\"origin_country\":\"US\"}],\"production_countries\":[{\"iso_3166_1\":\"US\",\"name\":\"United States of America\"}],\"release_date\":\"2021-04-29\",\"revenue\":0,\"runtime\":109,\"spoken_languages\":[{\"english_name\":\"English\",\"iso_639_1\":\"en\",\"name\":\"English\"}],\"status\":\"Released\",\"tagline\":\"From Tom Clancy, the author of Rainbow Six.\",\"title\":\"Tom Clancy's Without Remorse\",\"video\":false,\"vote_average\":7.3,\"vote_count\":992}"
+ private const val stringDetailMovieResponse = "{\"adult\":false,\"backdrop_path\":\"/fPGeS6jgdLovQAKunNHX8l0avCy.jpg\",\"belongs_to_collection\":null,\"budget\":0,\"genres\":[{\"id\":28,\"name\":\"Action\"},{\"id\":53,\"name\":\"Thriller\"},{\"id\":10752,\"name\":\"War\"}],\"homepage\":\"https://www.amazon.com/dp/B08VFD1Y3B\",\"id\":567189,\"imdb_id\":\"tt0499097\",\"original_language\":\"en\",\"original_title\":\"Tom Clancy's Without Remorse\",\"overview\":\"An elite Navy SEAL uncovers an international conspiracy while seeking justice for the murder of his pregnant wife.\",\"popularity\":3143.69,\"poster_path\":\"/rEm96ib0sPiZBADNKBHKBv5bve9.jpg\",\"production_companies\":[{\"id\":4,\"logo_path\":\"/fycMZt242LVjagMByZOLUGbCvv3.png\",\"name\":\"Paramount\",\"origin_country\":\"US\"},{\"id\":433,\"logo_path\":null,\"name\":\"Weed Road Pictures\",\"origin_country\":\"US\"},{\"id\":82819,\"logo_path\":\"/5Z8WWr0Lf1tInVWwJsxPP0uMz9a.png\",\"name\":\"Skydance Media\",\"origin_country\":\"US\"},{\"id\":51593,\"logo_path\":null,\"name\":\"Midnight Radio\",\"origin_country\":\"US\"},{\"id\":102334,\"logo_path\":\"/espa8KYmHedu5p7GRrP9FFICLUp.png\",\"name\":\"Outlier Society Productions\",\"origin_country\":\"US\"},{\"id\":114732,\"logo_path\":\"/tNCbisMxO5mX2X2bOQxHHQZVYnT.png\",\"name\":\"New Republic Pictures\",\"origin_country\":\"US\"},{\"id\":20580,\"logo_path\":\"/tkFE81jJIqiFYPP8Tho57MXRQEx.png\",\"name\":\"Amazon Studios\",\"origin_country\":\"US\"}],\"production_countries\":[{\"iso_3166_1\":\"US\",\"name\":\"United States of America\"}],\"release_date\":\"2021-04-29\",\"revenue\":0,\"runtime\":109,\"spoken_languages\":[{\"english_name\":\"English\",\"iso_639_1\":\"en\",\"name\":\"English\"}],\"status\":\"Released\",\"tagline\":\"From Tom Clancy, the author of Rainbow Six.\",\"title\":\"Tom Clancy's Without Remorse\",\"video\":false,\"vote_average\":7.3,\"vote_count\":996}"
- const val stringDetailSeriesResponse = "{\"backdrop_path\":\"/b0WmHGc8LHTdGCVzxRb3IBMur57.jpg\",\"created_by\":[{\"id\":1868712,\"credit_id\":\"605508e2960cde00721fc5e8\",\"name\":\"Malcolm Spellman\",\"gender\":2,\"profile_path\":\"/cNqxh76tysL9D8RcCKR6XqcoyW0.jpg\"}],\"episode_run_time\":[50],\"first_air_date\":\"2021-03-19\",\"genres\":[{\"id\":10765,\"name\":\"Sci-Fi & Fantasy\"},{\"id\":10759,\"name\":\"Action & Adventure\"},{\"id\":18,\"name\":\"Drama\"},{\"id\":10768,\"name\":\"War & Politics\"}],\"homepage\":\"https://www.disneyplus.com/series/the-falcon-and-the-winter-soldier/4gglDBMx8icA\",\"id\":88396,\"in_production\":false,\"languages\":[\"en\"],\"last_air_date\":\"2021-04-23\",\"last_episode_to_air\":{\"air_date\":\"2021-04-23\",\"episode_number\":6,\"id\":2558743,\"name\":\"One World, One People\",\"overview\":\"As The Flag Smashers escalate their efforts, Sam and Bucky take action.\",\"production_code\":\"\",\"season_number\":1,\"still_path\":\"/qXxCqMP7aj3rGndhVfGUyyU6hyq.jpg\",\"vote_average\":7.375,\"vote_count\":8},\"name\":\"The Falcon and the Winter Soldier\",\"next_episode_to_air\":null,\"networks\":[{\"name\":\"Disney+\",\"id\":2739,\"logo_path\":\"/gJ8VX6JSu3ciXHuC2dDGAo2lvwM.png\",\"origin_country\":\"US\"}],\"number_of_episodes\":6,\"number_of_seasons\":1,\"origin_country\":[\"US\"],\"original_language\":\"en\",\"original_name\":\"The Falcon and the Winter Soldier\",\"overview\":\"Following the events of “Avengers: Endgame”, the Falcon, Sam Wilson and the Winter Soldier, Bucky Barnes team up in a global adventure that tests their abilities, and their patience.\",\"popularity\":1143.513,\"poster_path\":\"/6kbAMLteGO8yyewYau6bJ683sw7.jpg\",\"production_companies\":[{\"id\":420,\"logo_path\":\"/hUzeosd33nzE5MCNsZxCGEKTXaQ.png\",\"name\":\"Marvel Studios\",\"origin_country\":\"US\"}],\"production_countries\":[{\"iso_3166_1\":\"US\",\"name\":\"United States of America\"}],\"seasons\":[{\"air_date\":\"2021-03-19\",\"episode_count\":6,\"id\":156676,\"name\":\"Season 1\",\"overview\":\"\",\"poster_path\":\"/fIT6Y6O3cUX1X8qY8pZgzEvxUDQ.jpg\",\"season_number\":1}],\"spoken_languages\":[{\"english_name\":\"English\",\"iso_639_1\":\"en\",\"name\":\"English\"}],\"status\":\"Ended\",\"tagline\":\"Honor the shield.\",\"type\":\"Miniseries\",\"vote_average\":7.9,\"vote_count\":5620}"
+ private const val stringDetailSeriesResponse = "{\"backdrop_path\":\"/b0WmHGc8LHTdGCVzxRb3IBMur57.jpg\",\"created_by\":[{\"id\":1868712,\"credit_id\":\"605508e2960cde00721fc5e8\",\"name\":\"Malcolm Spellman\",\"gender\":2,\"profile_path\":\"/cNqxh76tysL9D8RcCKR6XqcoyW0.jpg\"}],\"episode_run_time\":[50],\"first_air_date\":\"2021-03-19\",\"genres\":[{\"id\":10765,\"name\":\"Sci-Fi & Fantasy\"},{\"id\":10759,\"name\":\"Action & Adventure\"},{\"id\":18,\"name\":\"Drama\"},{\"id\":10768,\"name\":\"War & Politics\"}],\"homepage\":\"https://www.disneyplus.com/series/the-falcon-and-the-winter-soldier/4gglDBMx8icA\",\"id\":88396,\"in_production\":false,\"languages\":[\"en\"],\"last_air_date\":\"2021-04-23\",\"last_episode_to_air\":{\"air_date\":\"2021-04-23\",\"episode_number\":6,\"id\":2558743,\"name\":\"One World, One People\",\"overview\":\"As The Flag Smashers escalate their efforts, Sam and Bucky take action.\",\"production_code\":\"\",\"season_number\":1,\"still_path\":\"/qXxCqMP7aj3rGndhVfGUyyU6hyq.jpg\",\"vote_average\":7.375,\"vote_count\":8},\"name\":\"The Falcon and the Winter Soldier\",\"next_episode_to_air\":null,\"networks\":[{\"name\":\"Disney+\",\"id\":2739,\"logo_path\":\"/gJ8VX6JSu3ciXHuC2dDGAo2lvwM.png\",\"origin_country\":\"US\"}],\"number_of_episodes\":6,\"number_of_seasons\":1,\"origin_country\":[\"US\"],\"original_language\":\"en\",\"original_name\":\"The Falcon and the Winter Soldier\",\"overview\":\"Following the events of “Avengers: Endgame”, the Falcon, Sam Wilson and the Winter Soldier, Bucky Barnes team up in a global adventure that tests their abilities, and their patience.\",\"popularity\":1143.513,\"poster_path\":\"/6kbAMLteGO8yyewYau6bJ683sw7.jpg\",\"production_companies\":[{\"id\":420,\"logo_path\":\"/hUzeosd33nzE5MCNsZxCGEKTXaQ.png\",\"name\":\"Marvel Studios\",\"origin_country\":\"US\"}],\"production_countries\":[{\"iso_3166_1\":\"US\",\"name\":\"United States of America\"}],\"seasons\":[{\"air_date\":\"2021-03-19\",\"episode_count\":6,\"id\":156676,\"name\":\"Season 1\",\"overview\":\"\",\"poster_path\":\"/fIT6Y6O3cUX1X8qY8pZgzEvxUDQ.jpg\",\"season_number\":1}],\"spoken_languages\":[{\"english_name\":\"English\",\"iso_639_1\":\"en\",\"name\":\"English\"}],\"status\":\"Ended\",\"tagline\":\"Honor the shield.\",\"type\":\"Miniseries\",\"vote_average\":7.9,\"vote_count\":5620}"
fun generateMoviesList() : ArrayList{
val obj = Gson().fromJson(stringListMovieResponse, DiscoverMovieResponse::class.java)
diff --git a/app/src/main/java/com/faprayyy/tonton/view/adapter/MovieAdapter.kt b/app/src/main/java/com/faprayyy/tonton/view/adapter/MovieAdapter.kt
index 30e23d2..b753cf2 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/adapter/MovieAdapter.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/adapter/MovieAdapter.kt
@@ -1,7 +1,6 @@
package com.faprayyy.tonton.view.adapter
import android.annotation.SuppressLint
-import android.app.Activity
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.paging.PagedListAdapter
diff --git a/app/src/main/java/com/faprayyy/tonton/view/adapter/SeriesAdapter.kt b/app/src/main/java/com/faprayyy/tonton/view/adapter/SeriesAdapter.kt
index 770d98e..bd75bb5 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/adapter/SeriesAdapter.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/adapter/SeriesAdapter.kt
@@ -2,7 +2,6 @@ package com.faprayyy.tonton.view.adapter
import android.annotation.SuppressLint
import android.view.LayoutInflater
-import android.view.View
import android.view.ViewGroup
import androidx.paging.PagedListAdapter
import androidx.recyclerview.widget.DiffUtil
@@ -10,10 +9,8 @@ import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.faprayyy.tonton.R
-import com.faprayyy.tonton.data.local.entity.MovieEntity
import com.faprayyy.tonton.data.local.entity.SeriesEntity
import com.faprayyy.tonton.data.remote.Config
-import com.faprayyy.tonton.data.remote.response.SeriesModel
import com.faprayyy.tonton.databinding.ItemMovieBinding
class SeriesAdapter(private val listener : OnItemClickCallback) : PagedListAdapter(
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailmovie/DetailMovieActivity.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailmovie/DetailMovieActivity.kt
index b1589d4..7b1abeb 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailmovie/DetailMovieActivity.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailmovie/DetailMovieActivity.kt
@@ -20,7 +20,7 @@ import com.faprayyy.tonton.data.remote.response.MovieDetail
import com.faprayyy.tonton.databinding.ActivityDetailMovieBinding
import com.faprayyy.tonton.utils.Converter.convertGenres
import com.faprayyy.tonton.view.ui.detail.DetailViewModel
-import com.faprayyy.tonton.view.ui.search.SearchActivity
+import com.faprayyy.tonton.view.ui.favorite.FavoriteActivity
import com.faprayyy.tonton.vo.StatusMessage
import dagger.hilt.android.AndroidEntryPoint
import java.util.*
@@ -201,8 +201,8 @@ class DetailMovieActivity : AppCompatActivity() {
setOnMenuItemClickListener {
when(it?.itemId){
R.id.menu_share_item -> { onShareClick(movieDetail) }
- R.id.menu_search_item -> {
- val intent = Intent(context, SearchActivity::class.java)
+ R.id.menu_favorite_item -> {
+ val intent = Intent(context, FavoriteActivity::class.java)
startActivity(intent)
}
}
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailseries/DetailSeriesActivity.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailseries/DetailSeriesActivity.kt
index 31a9c93..d88c4f9 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailseries/DetailSeriesActivity.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/detail/detailseries/DetailSeriesActivity.kt
@@ -20,7 +20,7 @@ import com.faprayyy.tonton.data.remote.response.SeriesDetail
import com.faprayyy.tonton.databinding.ActivityDetailSeriesBinding
import com.faprayyy.tonton.utils.Converter.convertGenres
import com.faprayyy.tonton.view.ui.detail.DetailViewModel
-import com.faprayyy.tonton.view.ui.search.SearchActivity
+import com.faprayyy.tonton.view.ui.favorite.FavoriteActivity
import com.faprayyy.tonton.vo.StatusMessage
import dagger.hilt.android.AndroidEntryPoint
import java.util.*
@@ -190,8 +190,8 @@ class DetailSeriesActivity : AppCompatActivity() {
setOnMenuItemClickListener {
when(it?.itemId){
R.id.menu_share_item -> { onShareClick(seriesDetail) }
- R.id.menu_search_item -> {
- val intent = Intent(context, SearchActivity::class.java)
+ R.id.menu_favorite_item -> {
+ val intent = Intent(context, FavoriteActivity::class.java)
startActivity(intent)
}
}
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteActivity.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteActivity.kt
index 9f3023d..0ae7ca6 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteActivity.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteActivity.kt
@@ -1,13 +1,11 @@
package com.faprayyy.tonton.view.ui.favorite
-import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
-import android.util.Log
import android.view.View
import androidx.activity.viewModels
+import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProvider
import androidx.paging.PagedList
import androidx.recyclerview.widget.LinearLayoutManager
import com.faprayyy.tonton.R
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModel.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModel.kt
index 9fa2bbd..7d73d27 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModel.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModel.kt
@@ -2,10 +2,9 @@ package com.faprayyy.tonton.view.ui.favorite
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
-import androidx.paging.LivePagedListBuilder
import androidx.paging.PagedList
-import com.faprayyy.tonton.data.local.entity.FavoriteEntity
import com.faprayyy.tonton.data.MuviDBRepository
+import com.faprayyy.tonton.data.local.entity.FavoriteEntity
import com.faprayyy.tonton.utils.SortUtils
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/main/MainViewModel.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/main/MainViewModel.kt
index 8104860..545d471 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/main/MainViewModel.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/main/MainViewModel.kt
@@ -1,13 +1,11 @@
package com.faprayyy.tonton.view.ui.main
import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.paging.PagedList
import com.faprayyy.tonton.data.MuviDBRepository
import com.faprayyy.tonton.data.local.entity.MovieEntity
import com.faprayyy.tonton.data.local.entity.SeriesEntity
-import com.faprayyy.tonton.data.remote.response.MovieModel
import com.faprayyy.tonton.vo.Resource
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/main/movie/MoviesFragment.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/main/movie/MoviesFragment.kt
index 144c917..51cc4cf 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/main/movie/MoviesFragment.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/main/movie/MoviesFragment.kt
@@ -2,7 +2,6 @@ package com.faprayyy.tonton.view.ui.main.movie
import android.content.Intent
import android.os.Bundle
-import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -15,7 +14,6 @@ import com.faprayyy.tonton.view.adapter.MovieAdapter
import com.faprayyy.tonton.view.ui.detail.detailmovie.DetailMovieActivity
import com.faprayyy.tonton.view.ui.favorite.FavoriteActivity
import com.faprayyy.tonton.view.ui.main.MainViewModel
-import com.faprayyy.tonton.view.ui.search.SearchActivity
import com.faprayyy.tonton.vo.StatusMessage
import dagger.hilt.android.AndroidEntryPoint
@@ -78,10 +76,6 @@ class MoviesFragment : Fragment() {
binding.toolbar.apply {
setOnMenuItemClickListener {
when(it?.itemId){
- R.id.menu_search_item -> {
- val intent = Intent(context, SearchActivity::class.java)
- startActivity(intent)
- }
R.id.menu_favorite_item -> {
val intent = Intent(context, FavoriteActivity::class.java)
startActivity(intent)
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/main/series/SeriesFragment.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/main/series/SeriesFragment.kt
index e413f83..2b14f9b 100644
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/main/series/SeriesFragment.kt
+++ b/app/src/main/java/com/faprayyy/tonton/view/ui/main/series/SeriesFragment.kt
@@ -2,7 +2,6 @@ package com.faprayyy.tonton.view.ui.main.series
import android.content.Intent
import android.os.Bundle
-import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,11 +11,9 @@ import com.faprayyy.tonton.R
import com.faprayyy.tonton.data.local.entity.SeriesEntity
import com.faprayyy.tonton.databinding.FragmentSeriesBinding
import com.faprayyy.tonton.view.adapter.SeriesAdapter
-import com.faprayyy.tonton.view.ui.detail.detailmovie.DetailMovieActivity
import com.faprayyy.tonton.view.ui.detail.detailseries.DetailSeriesActivity
import com.faprayyy.tonton.view.ui.favorite.FavoriteActivity
import com.faprayyy.tonton.view.ui.main.MainViewModel
-import com.faprayyy.tonton.view.ui.search.SearchActivity
import com.faprayyy.tonton.vo.StatusMessage
import dagger.hilt.android.AndroidEntryPoint
@@ -77,10 +74,6 @@ class SeriesFragment : Fragment() {
binding.toolbar.apply {
setOnMenuItemClickListener {
when(it?.itemId){
- R.id.menu_search_item -> {
- val intent = Intent(context, SearchActivity::class.java)
- startActivity(intent)
- }
R.id.menu_favorite_item -> {
val intent = Intent(context, FavoriteActivity::class.java)
startActivity(intent)
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchActivity.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchActivity.kt
deleted file mode 100644
index 840997a..0000000
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchActivity.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.faprayyy.tonton.view.ui.search
-
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import com.faprayyy.tonton.databinding.ActivitySearchBinding
-
-class SearchActivity : AppCompatActivity() {
- private lateinit var binding : ActivitySearchBinding
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- binding = ActivitySearchBinding.inflate(layoutInflater)
- setContentView(binding.root)
-
- binding.btnBack.setOnClickListener{
- onBackPressed()
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchViewModel.kt b/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchViewModel.kt
deleted file mode 100644
index f144a44..0000000
--- a/app/src/main/java/com/faprayyy/tonton/view/ui/search/SearchViewModel.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.faprayyy.tonton.view.ui.search
-
-import androidx.lifecycle.ViewModel
-import com.faprayyy.tonton.data.MuviDBRepository
-
-class SearchViewModel(private val mMuviDBRepository: MuviDBRepository) : ViewModel() {
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/faprayyy/tonton/vo/Resource.kt b/app/src/main/java/com/faprayyy/tonton/vo/Resource.kt
index 2888e8a..4e104a5 100644
--- a/app/src/main/java/com/faprayyy/tonton/vo/Resource.kt
+++ b/app/src/main/java/com/faprayyy/tonton/vo/Resource.kt
@@ -8,6 +8,5 @@ class Resource(val status: StatusMessage, val data: T?, val message: String?)
fun loading(data: T?): Resource = Resource(StatusMessage.LOADING, data, null)
- fun empty(msg: String, data: T?): Resource = Resource(StatusMessage.EMPTY, data, msg)
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml
deleted file mode 100644
index 374e30b..0000000
--- a/app/src/main/res/layout/activity_search.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/detail_menu.xml b/app/src/main/res/menu/detail_menu.xml
index b76cc19..9b2272f 100644
--- a/app/src/main/res/menu/detail_menu.xml
+++ b/app/src/main/res/menu/detail_menu.xml
@@ -1,11 +1,6 @@
\ No newline at end of file
diff --git a/app/src/test/java/com/faprayyy/tonton/view/ui/detail/DetailViewModelTest.kt b/app/src/test/java/com/faprayyy/tonton/view/ui/detail/DetailViewModelTest.kt
index 5462bfe..46f0f0b 100644
--- a/app/src/test/java/com/faprayyy/tonton/view/ui/detail/DetailViewModelTest.kt
+++ b/app/src/test/java/com/faprayyy/tonton/view/ui/detail/DetailViewModelTest.kt
@@ -8,11 +8,11 @@ import com.faprayyy.tonton.data.remote.response.MovieDetail
import com.faprayyy.tonton.data.remote.response.SeriesDetail
import com.faprayyy.tonton.utils.DataDummy
import com.faprayyy.tonton.utils.LiveDataTestUtils
-import com.faprayyy.tonton.utils.SortUtils
import com.faprayyy.tonton.view.ui.detail.detailmovie.DetailMovieActivity.Companion.MOVIE_TYPE
import com.faprayyy.tonton.view.ui.detail.detailseries.DetailSeriesActivity.Companion.SERIES_TYPE
import com.faprayyy.tonton.vo.Resource
-import org.junit.Assert.*
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNotNull
import org.junit.Rule
import org.junit.Test
import org.mockito.Mockito
diff --git a/app/src/test/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModelTest.kt b/app/src/test/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModelTest.kt
index 34b069f..d90cb37 100644
--- a/app/src/test/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModelTest.kt
+++ b/app/src/test/java/com/faprayyy/tonton/view/ui/favorite/FavoriteViewModelTest.kt
@@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.paging.PagedList
-import androidx.paging.PositionalDataSource
import com.faprayyy.tonton.data.MuviDBRepository
import com.faprayyy.tonton.data.local.entity.FavoriteEntity
import com.faprayyy.tonton.utils.DataDummy
@@ -18,7 +17,6 @@ import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnitRunner
-import java.util.concurrent.Executors
@RunWith(MockitoJUnitRunner::class)
class FavoriteViewModelTest{
diff --git a/app/src/test/java/com/faprayyy/tonton/view/ui/movie/MainViewModelTestt.kt b/app/src/test/java/com/faprayyy/tonton/view/ui/movie/MainViewModelTestt.kt
deleted file mode 100644
index 2c9d72b..0000000
--- a/app/src/test/java/com/faprayyy/tonton/view/ui/movie/MainViewModelTestt.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.faprayyy.tonton.view.ui.movie
-
-import androidx.arch.core.executor.testing.InstantTaskExecutorRule
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.Observer
-import com.faprayyy.tonton.data.MuviDBRepository
-import com.faprayyy.tonton.data.remote.response.MovieModel
-import com.faprayyy.tonton.utils.DataDummy.generateMoviesList
-import com.faprayyy.tonton.view.ui.main.MainViewModel
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.Mock
-import org.mockito.Mockito.*
-import org.mockito.junit.MockitoJUnitRunner
-
-/*
-@RunWith(MockitoJUnitRunner::class)
-class MainViewModelTest{
-
- private lateinit var viewModel: MainViewModel
-
- @get:Rule
- var instantTaskExecutorRule = InstantTaskExecutorRule()
-
- @Mock
- private lateinit var muviDBRepository: MuviDBRepository
-
- @Mock
- private lateinit var observer: Observer>
-
- @Before
- fun setUp() {
- viewModel = MainViewModel(muviDBRepository)
- }
-
- @Test
- fun getMoviesList(){
- val dummyMovieList = generateMoviesList()
- val moviesListLive = MutableLiveData>()
- moviesListLive.value = dummyMovieList
-
- `when`(muviDBRepository.getMovieFromApi()).thenReturn(moviesListLive)
- viewModel.getMoviesListFromApi()
- val moviesList = viewModel.getMoviesList().value
-
- verify(muviDBRepository).getMovieFromApi()
- Assert.assertNotNull(moviesList)
- Assert.assertEquals(20, moviesList?.size)
-
- viewModel.getMoviesList().observeForever(observer)
- verify(observer).onChanged(dummyMovieList)
- }
-}
-
-*/
\ No newline at end of file
diff --git a/app/src/test/java/com/faprayyy/tonton/view/ui/series/SeriesViewModelTestt.kt b/app/src/test/java/com/faprayyy/tonton/view/ui/series/SeriesViewModelTestt.kt
deleted file mode 100644
index 0d8f563..0000000
--- a/app/src/test/java/com/faprayyy/tonton/view/ui/series/SeriesViewModelTestt.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.faprayyy.tonton.view.ui.series
-
-import androidx.arch.core.executor.testing.InstantTaskExecutorRule
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.Observer
-import com.faprayyy.tonton.data.MuviDBRepository
-import com.faprayyy.tonton.data.remote.response.SeriesModel
-import com.faprayyy.tonton.utils.DataDummy.generateSeriesList
-import org.junit.Test
-import org.junit.Assert.*
-import org.junit.Before
-import org.junit.Rule
-import org.junit.runner.RunWith
-import org.mockito.Mock
-import org.mockito.Mockito.*
-import org.mockito.junit.MockitoJUnitRunner
-
-/*
-@RunWith(MockitoJUnitRunner::class)
-class SeriesViewModelTest {
-
- private lateinit var viewModel: SeriesViewModel
- @get:Rule
-
- var instantTaskExecutorRule = InstantTaskExecutorRule()
-
- @Mock
- private lateinit var muviDBRepository: MuviDBRepository
-
- @Mock
- private lateinit var observer: Observer>
-
- @Before
- fun setUp() {
- viewModel = SeriesViewModel(muviDBRepository)
- }
-
- @Test
- fun getSeriesList() {
- val dummySeriesList = generateSeriesList()
- val seriesListLive = MutableLiveData>()
- seriesListLive.value = dummySeriesList
-
- `when`(muviDBRepository.getSeriesFromApi()).thenReturn(seriesListLive)
- viewModel.getSeriesListFromApi()
- val seriesList = viewModel.getSeriesList().value
-
- verify(muviDBRepository).getSeriesFromApi()
- assertNotNull(seriesList)
- assertEquals(dummySeriesList.size, seriesList?.size)
-
- viewModel.getSeriesList().observeForever(observer)
- verify(observer).onChanged(dummySeriesList)
- }
-}
-
- */
\ No newline at end of file