From 190e697a271f5f84e2fc53ecc71d1ac2448aac28 Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 17:20:16 +0200 Subject: [PATCH 1/8] =?UTF-8?q?=D0=9E=D1=82=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=20Gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 603b140..6f6d9f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.iml .gradle /local.properties +/.idea /.idea/caches /.idea/libraries /.idea/modules.xml From 44b89d4a4be4145c32ceac284aa9e76de89173f8 Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 17:57:04 +0200 Subject: [PATCH 2/8] Deleted function in BindingAdapter Refactoring code Add .idea packet in gitignore --- .gitignore | 4 -- .../com/example/movieapp/BindingAdapter.kt | 71 ++----------------- app/src/main/res/layout/detail_fragment.xml | 16 ++--- app/src/main/res/layout/item.xml | 14 ++-- 4 files changed, 20 insertions(+), 85 deletions(-) diff --git a/.gitignore b/.gitignore index 6f6d9f7..9847dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ .gradle /local.properties /.idea -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml /.idea/navEditor.xml /.idea/assetWizardSettings.xml .DS_Store diff --git a/app/src/main/java/com/example/movieapp/BindingAdapter.kt b/app/src/main/java/com/example/movieapp/BindingAdapter.kt index cb4a5e0..e57531b 100644 --- a/app/src/main/java/com/example/movieapp/BindingAdapter.kt +++ b/app/src/main/java/com/example/movieapp/BindingAdapter.kt @@ -15,7 +15,12 @@ import com.example.movieapp.overview.MovieAdapter @BindingAdapter("imageUrl") fun bindImage(imageView: ImageView, imgUrl: String?) { imgUrl?.let { - val imgUri = imgUrl.toUri().buildUpon().scheme("https").build() + val imgUri = imgUrl + .toUri() + .buildUpon() + .scheme("https") + .build() + Glide.with(imageView.context) .load(imgUri) .apply( @@ -27,70 +32,6 @@ fun bindImage(imageView: ImageView, imgUrl: String?) { } } -//Binding adapter used to display title from object -@BindingAdapter("title") -fun bindTitle(textView: TextView, title: String?) { - title?.let { - textView.text = title - } -} - -//Binding adapter used to display plot from object -@BindingAdapter("plot") -fun TextView.bindPlot(plot: String?) { - plot?.let { - text = plot - } -} - -//Binding adapter used to display year from object -@BindingAdapter("year") -fun TextView.bindYear(year: Int?) { - year?.let { - text = year.toString() - } -} - -//Binding adapter used to display time from object -@BindingAdapter("time") -fun TextView.bindTime(time: String?) { - time?.let { - text = time - } -} - -//Binding adapter used to display language from object -@BindingAdapter("language") -fun TextView.bindLanguage(language: String?) { - language?.let { - text = language - } -} - -//Binding adapter used to display writer from object -@BindingAdapter("writer") -fun TextView.bindWriter(writer: String?) { - writer?.let { - text = writer - } -} - -//Binding adapter used to display actors from object -@BindingAdapter("actors") -fun TextView.bindActors(actors: String?) { - actors?.let { - text = actors - } -} - -//Binding adapter used to display genre from object -@BindingAdapter("genre") -fun TextView.bindGenre(genre: String?) { - genre?.let { - text = genre - } -} - //Binding adapter used to set adapter of RecyclerView @BindingAdapter("listData") diff --git a/app/src/main/res/layout/detail_fragment.xml b/app/src/main/res/layout/detail_fragment.xml index e3ba214..b8bd51a 100644 --- a/app/src/main/res/layout/detail_fragment.xml +++ b/app/src/main/res/layout/detail_fragment.xml @@ -51,7 +51,7 @@ app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toEndOf="@+id/imageView" app:layout_constraintTop_toTopOf="@+id/imageView" - app:title="@{viewModel.selectProperty.title}" + android:text="@{viewModel.selectProperty.title}" tools:text="They Shall Not Grow Old" /> + android:text="@{String.valueOf(viewModel.selectProperty.year)}" /> + android:text="@{viewModel.selectProperty.genre}" /> + android:text="@{viewModel.selectProperty.time}" /> + android:text="@{viewModel.selectProperty.language}" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item.xml b/app/src/main/res/layout/item.xml index eeceb44..f23ed63 100644 --- a/app/src/main/res/layout/item.xml +++ b/app/src/main/res/layout/item.xml @@ -43,10 +43,9 @@ android:layout_marginEnd="16dp" android:ellipsize="end" android:maxLines="1" - android:text="TextView" + android:text="@{movie.title}" android:textColor="?attr/actionMenuTextColor" android:textSize="18sp" - android:textStyle="bold" app:layout_constraintBottom_toBottomOf="@+id/poster" app:layout_constraintEnd_toStartOf="@+id/year" @@ -54,19 +53,19 @@ app:layout_constraintStart_toEndOf="@+id/poster" app:layout_constraintTop_toTopOf="@+id/poster" app:layout_constraintVertical_bias="0.0" - app:title="@{movie.title}" /> + /> + /> + app:layout_constraintVertical_bias="0.0" /> Date: Fri, 7 Feb 2020 18:01:18 +0200 Subject: [PATCH 3/8] Add .idea packet in gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9847dc7..158202a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.iml .gradle /local.properties -/.idea +.idea /.idea/navEditor.xml /.idea/assetWizardSettings.xml .DS_Store From dd99c89663f20c4b6c0c73b08e9ca83e00c4e017 Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:03:53 +0200 Subject: [PATCH 4/8] Add .idea packet in gitignore --- .gitignore | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 158202a..ecf627d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,5 @@ *.iml .gradle /local.properties -.idea -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store +/.idea /build -/captures -.externalNativeBuild -.cxx From c6626cb0d1130e02deeb6ccc61c75a1ba2baa64c Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:06:45 +0200 Subject: [PATCH 5/8] Add .idea packet in gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ecf627d..cb20e99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.iml .gradle /local.properties -/.idea +.DS_Store +.idea /build From a602a8591f012772c1892daa6803cceb7aba3b6e Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:20:32 +0200 Subject: [PATCH 6/8] Code correcting Extra space removed Deleted logic in xml --- .gitignore | 3 ++- .../com/example/movieapp/BindingAdapter.kt | 19 +------------------ .../java/com/example/movieapp/MainActivity.kt | 2 +- .../movieapp/database/DatabaseEntities.kt | 2 +- .../movieapp/detail/DetailViewModel.kt | 2 +- .../java/com/example/movieapp/domain/Movie.kt | 5 +++-- .../example/movieapp/overview/MovieAdapter.kt | 3 +-- .../movieapp/overview/OverviewFragment.kt | 2 +- .../movieapp/overview/OverviewViewModel.kt | 2 +- .../movieapp/repository/MoviesRepository.kt | 2 +- app/src/main/res/layout/detail_fragment.xml | 4 ++-- app/src/main/res/layout/item.xml | 9 +++------ app/src/main/res/layout/overview_fragment.xml | 1 - 13 files changed, 18 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index cb20e99..e5b6ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.iml .gradle /local.properties -.DS_Store + .idea + /build diff --git a/app/src/main/java/com/example/movieapp/BindingAdapter.kt b/app/src/main/java/com/example/movieapp/BindingAdapter.kt index e57531b..5fb05a6 100644 --- a/app/src/main/java/com/example/movieapp/BindingAdapter.kt +++ b/app/src/main/java/com/example/movieapp/BindingAdapter.kt @@ -49,21 +49,4 @@ fun hideIfNetworkError(view: View, isNetWorkError: Boolean, playlist: Any?) { if (isNetWorkError) { view.visibility = View.GONE } -} - - - - - - - - - - - - - - - - - +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/MainActivity.kt b/app/src/main/java/com/example/movieapp/MainActivity.kt index c041d5d..6b771e5 100644 --- a/app/src/main/java/com/example/movieapp/MainActivity.kt +++ b/app/src/main/java/com/example/movieapp/MainActivity.kt @@ -20,4 +20,4 @@ class MainActivity : AppCompatActivity() { val graph = inflater.inflate(R.navigation.navigation) myNavHostFragment.navController.graph = graph } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/database/DatabaseEntities.kt b/app/src/main/java/com/example/movieapp/database/DatabaseEntities.kt index 163cce0..6effc38 100644 --- a/app/src/main/java/com/example/movieapp/database/DatabaseEntities.kt +++ b/app/src/main/java/com/example/movieapp/database/DatabaseEntities.kt @@ -43,4 +43,4 @@ fun List.asDomainModel(): List { ) } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/detail/DetailViewModel.kt b/app/src/main/java/com/example/movieapp/detail/DetailViewModel.kt index 46b00c9..161d44a 100644 --- a/app/src/main/java/com/example/movieapp/detail/DetailViewModel.kt +++ b/app/src/main/java/com/example/movieapp/detail/DetailViewModel.kt @@ -15,4 +15,4 @@ class DetailViewModel(movieProperty: Movie) : ViewModel() { init { _selectProperty.value = movieProperty } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/domain/Movie.kt b/app/src/main/java/com/example/movieapp/domain/Movie.kt index 939c1c4..14da38d 100644 --- a/app/src/main/java/com/example/movieapp/domain/Movie.kt +++ b/app/src/main/java/com/example/movieapp/domain/Movie.kt @@ -1,6 +1,7 @@ package com.example.movieapp.domain import android.os.Parcelable +import android.view.View import kotlinx.android.parcel.Parcelize /** @@ -23,6 +24,6 @@ data class Movie( val writer: String, val actors: String ) : Parcelable { - val isR - get() = rated == "R" + + val plus18 = if (rated == "R") View.GONE else View.VISIBLE } \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt b/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt index 7ed9470..1f03659 100644 --- a/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt +++ b/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt @@ -50,5 +50,4 @@ class MovieAdapter(private val onClickListener: ClickListener) : class ClickListener(val clickListener: (movie: Movie) -> Unit) { fun onClick(movie: Movie) = clickListener(movie) } -} - +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt b/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt index d683164..b2a0b24 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt @@ -71,4 +71,4 @@ class OverviewFragment : Fragment() { viewModel.onNetworkErrorShown() } } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt index 8cf8d14..5b83e06 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt @@ -60,4 +60,4 @@ class OverviewViewModel(application: Application) : ViewModel() { fun onNetworkErrorShown() { _isNetworkErrorShown.value = true } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/repository/MoviesRepository.kt b/app/src/main/java/com/example/movieapp/repository/MoviesRepository.kt index a9eb305..aff074b 100644 --- a/app/src/main/java/com/example/movieapp/repository/MoviesRepository.kt +++ b/app/src/main/java/com/example/movieapp/repository/MoviesRepository.kt @@ -24,4 +24,4 @@ class MoviesRepository(private val movieDatabase: MovieDatabase) { val movies: LiveData> = Transformations.map(movieDatabase.movieDao.getMovies()) { it.asDomainModel() } -} +} \ No newline at end of file diff --git a/app/src/main/res/layout/detail_fragment.xml b/app/src/main/res/layout/detail_fragment.xml index b8bd51a..2794ca7 100644 --- a/app/src/main/res/layout/detail_fragment.xml +++ b/app/src/main/res/layout/detail_fragment.xml @@ -169,7 +169,6 @@ app:layout_constraintTop_toBottomOf="@+id/textView6" tools:text="Mark Kermode, Peter Jackson" /> - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/item.xml b/app/src/main/res/layout/item.xml index f23ed63..f7928cc 100644 --- a/app/src/main/res/layout/item.xml +++ b/app/src/main/res/layout/item.xml @@ -52,8 +52,7 @@ app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toEndOf="@+id/poster" app:layout_constraintTop_toTopOf="@+id/poster" - app:layout_constraintVertical_bias="0.0" - /> + app:layout_constraintVertical_bias="0.0" /> - + app:layout_constraintTop_toTopOf="@+id/title" /> diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index d6c2705..da9e1dd 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -53,6 +53,5 @@ app:layout_constraintTop_toTopOf="parent" app:playlist="@{viewModel.playList}" /> - From 991f639890031b1e3137981cb92ee130d25a9514 Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:38:35 +0200 Subject: [PATCH 7/8] Code correcting Extra import removed Separated MovieApiService and MovieApi --- .../com/example/movieapp/BindingAdapter.kt | 1 - .../example/movieapp/detail/DetailFragment.kt | 12 ++++++------ .../com/example/movieapp/network/MovieApi.kt | 19 +++++++++++++++++++ .../movieapp/network/MovieApiService.kt | 15 --------------- .../example/movieapp/network/MovieProperty.kt | 3 +-- .../example/movieapp/overview/MovieAdapter.kt | 1 - .../movieapp/overview/OverviewFragment.kt | 4 +--- .../movieapp/overview/OverviewViewModel.kt | 3 --- 8 files changed, 27 insertions(+), 31 deletions(-) create mode 100644 app/src/main/java/com/example/movieapp/network/MovieApi.kt diff --git a/app/src/main/java/com/example/movieapp/BindingAdapter.kt b/app/src/main/java/com/example/movieapp/BindingAdapter.kt index 5fb05a6..0724d0f 100644 --- a/app/src/main/java/com/example/movieapp/BindingAdapter.kt +++ b/app/src/main/java/com/example/movieapp/BindingAdapter.kt @@ -2,7 +2,6 @@ package com.example.movieapp import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.core.net.toUri import androidx.databinding.BindingAdapter import androidx.recyclerview.widget.RecyclerView diff --git a/app/src/main/java/com/example/movieapp/detail/DetailFragment.kt b/app/src/main/java/com/example/movieapp/detail/DetailFragment.kt index 77c8423..debb037 100644 --- a/app/src/main/java/com/example/movieapp/detail/DetailFragment.kt +++ b/app/src/main/java/com/example/movieapp/detail/DetailFragment.kt @@ -9,7 +9,6 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController import com.example.movieapp.databinding.DetailFragmentBinding -import java.util.* class DetailFragment : Fragment() { @@ -30,12 +29,13 @@ class DetailFragment : Fragment() { // Create Toolbar and button of back in toolbar val myToolbar = binding.toolbar - @Suppress("UNNECESSARY_SAFE_CALL") - Objects.requireNonNull((activity as AppCompatActivity)).apply { + (activity as AppCompatActivity).apply { setSupportActionBar(myToolbar) - supportActionBar?.setDisplayHomeAsUpEnabled(true) - supportActionBar?.setHomeButtonEnabled(true) - supportActionBar?.setDisplayShowTitleEnabled(false) + supportActionBar?.apply { + setDisplayHomeAsUpEnabled(true) + setHomeButtonEnabled(true) + setDisplayShowTitleEnabled(false) + } title = movie.title } diff --git a/app/src/main/java/com/example/movieapp/network/MovieApi.kt b/app/src/main/java/com/example/movieapp/network/MovieApi.kt new file mode 100644 index 0000000..1690679 --- /dev/null +++ b/app/src/main/java/com/example/movieapp/network/MovieApi.kt @@ -0,0 +1,19 @@ +package com.example.movieapp.network + +import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory +import retrofit2.Retrofit +import retrofit2.converter.moshi.MoshiConverterFactory + +private const val BASE_URL = "https://api.myjson.com/bins/" + +//Main entry point for network access +object MovieApi { + + private val retrofit = Retrofit.Builder() + .addConverterFactory(MoshiConverterFactory.create()) + .addCallAdapterFactory(CoroutineCallAdapterFactory()) + .baseUrl(BASE_URL) + .build() + + val retrofitService: MovieApiService = retrofit.create(MovieApiService::class.java) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/network/MovieApiService.kt b/app/src/main/java/com/example/movieapp/network/MovieApiService.kt index 9a010df..db8db23 100644 --- a/app/src/main/java/com/example/movieapp/network/MovieApiService.kt +++ b/app/src/main/java/com/example/movieapp/network/MovieApiService.kt @@ -1,11 +1,7 @@ package com.example.movieapp.network -import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory -import retrofit2.Retrofit -import retrofit2.converter.moshi.MoshiConverterFactory import retrofit2.http.GET -private const val BASE_URL = "https://api.myjson.com/bins/" //A retrofit service to fetch movie playlist. interface MovieApiService { @@ -14,14 +10,3 @@ interface MovieApiService { } -//Main entry point for network access -object MovieApi { - - private val retrofit = Retrofit.Builder() - .addConverterFactory(MoshiConverterFactory.create()) - .addCallAdapterFactory(CoroutineCallAdapterFactory()) - .baseUrl(BASE_URL) - .build() - - val retrofitService: MovieApiService = retrofit.create(MovieApiService::class.java) -} \ No newline at end of file diff --git a/app/src/main/java/com/example/movieapp/network/MovieProperty.kt b/app/src/main/java/com/example/movieapp/network/MovieProperty.kt index 451ddc4..89838d8 100644 --- a/app/src/main/java/com/example/movieapp/network/MovieProperty.kt +++ b/app/src/main/java/com/example/movieapp/network/MovieProperty.kt @@ -17,8 +17,7 @@ data class MovieProperty( @Json(name = "Runtime") val time: String, @Json(name = "Language") val language: String, @Json(name = "Writer") val writer: String, - @Json(name = "Actors") val actors:String - + @Json(name = "Actors") val actors: String ) //Convert network result to database object diff --git a/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt b/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt index 1f03659..b5d0c32 100644 --- a/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt +++ b/app/src/main/java/com/example/movieapp/overview/MovieAdapter.kt @@ -34,7 +34,6 @@ class MovieAdapter(private val onClickListener: ClickListener) : } } - //Class for comparing the old list and the new one, and updating it class DiffCallback : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: Movie, newItem: Movie): Boolean { diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt b/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt index b2a0b24..216a506 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewFragment.kt @@ -51,9 +51,7 @@ class OverviewFragment : Fragment() { }) //Looking for the internet connection - viewModel.eventNetworkError.observe( - viewLifecycleOwner, - Observer { isNetworkError -> + viewModel.eventNetworkError.observe(viewLifecycleOwner, Observer { isNetworkError -> if (isNetworkError) onNetworkError() }) diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt index 5b83e06..ba423cd 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt @@ -42,9 +42,6 @@ class OverviewViewModel(application: Application) : ViewModel() { _eventNetworkError.value = false _isNetworkErrorShown.value = false } catch (e: Exception) { - if (playList.value!!.isEmpty()) { - _eventNetworkError.value = true - } } } } From 24ada98df66eedf9a79f2d62998e85133b9303da Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:45:03 +0200 Subject: [PATCH 8/8] Fixed bug with isEmpty --- .../java/com/example/movieapp/overview/OverviewViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt index ba423cd..e77b020 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt @@ -10,7 +10,6 @@ import com.example.movieapp.domain.Movie import com.example.movieapp.repository.MoviesRepository import kotlinx.coroutines.launch - class OverviewViewModel(application: Application) : ViewModel() { //LiveData object of movie @@ -42,6 +41,9 @@ class OverviewViewModel(application: Application) : ViewModel() { _eventNetworkError.value = false _isNetworkErrorShown.value = false } catch (e: Exception) { + if (playList.value.isNullOrEmpty()) { + _eventNetworkError.value = true + } } } }