From abb584618bba2d2c43147fc8f23057acc72bd95b Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 8 Jun 2022 11:33:11 +0200 Subject: [PATCH] empty playlist thumbnail --- .../com/github/libretube/adapters/PlaylistsAdapter.kt | 8 +++++--- app/src/main/res/drawable/ic_empty_playlist.xml | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/drawable/ic_empty_playlist.xml diff --git a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt index 462645cc2..63fd37428 100644 --- a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt @@ -8,7 +8,6 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView -import androidx.core.net.toUri import androidx.core.os.bundleOf import androidx.recyclerview.widget.RecyclerView import com.github.libretube.MainActivity @@ -18,10 +17,10 @@ import com.github.libretube.obj.Playlists import com.github.libretube.util.RetrofitInstance import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.squareup.picasso.Picasso -import java.io.IOException import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import retrofit2.HttpException +import java.io.IOException class PlaylistsAdapter( private val playlists: MutableList, @@ -48,7 +47,10 @@ class PlaylistsAdapter( val thumbnailImage = holder.v.findViewById(R.id.playlist_thumbnail) Picasso.get().load(playlist.thumbnail).into(thumbnailImage) // set imageview drawable as empty playlist if imageview empty - // if (thumbnailImage.drawable == null) thumbnailImage.setImageResource(R.mipmap.empty_playlist) + if (thumbnailImage.drawable == null) { + thumbnailImage.setImageResource(R.drawable.ic_empty_playlist) + thumbnailImage.setBackgroundColor(R.attr.colorSurface) + } holder.v.findViewById(R.id.playlist_title).text = playlist.name holder.v.findViewById(R.id.delete_playlist).setOnClickListener { val builder = MaterialAlertDialogBuilder(holder.v.context) diff --git a/app/src/main/res/drawable/ic_empty_playlist.xml b/app/src/main/res/drawable/ic_empty_playlist.xml new file mode 100644 index 000000000..819452cc1 --- /dev/null +++ b/app/src/main/res/drawable/ic_empty_playlist.xml @@ -0,0 +1,11 @@ + + +