empty playlist thumbnail

This commit is contained in:
Bnyro 2022-06-08 11:33:11 +02:00
parent b57ef5a256
commit abb584618b
2 changed files with 16 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.net.toUri
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.MainActivity import com.github.libretube.MainActivity
@ -18,10 +17,10 @@ import com.github.libretube.obj.Playlists
import com.github.libretube.util.RetrofitInstance import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import java.io.IOException
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException
class PlaylistsAdapter( class PlaylistsAdapter(
private val playlists: MutableList<Playlists>, private val playlists: MutableList<Playlists>,
@ -48,7 +47,10 @@ class PlaylistsAdapter(
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail) val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail)
Picasso.get().load(playlist.thumbnail).into(thumbnailImage) Picasso.get().load(playlist.thumbnail).into(thumbnailImage)
// set imageview drawable as empty playlist if imageview empty // 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<TextView>(R.id.playlist_title).text = playlist.name holder.v.findViewById<TextView>(R.id.playlist_title).text = playlist.name
holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener { holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener {
val builder = MaterialAlertDialogBuilder(holder.v.context) val builder = MaterialAlertDialogBuilder(holder.v.context)

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="143dp"
android:height="144dp"
android:viewportWidth="143"
android:viewportHeight="144"
android:tint="?android:attr/colorControlNormal" >
<path
android:pathData="M35.74,87.66L35.74,41.39c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h45.95v5.4L41.11,41.39L41.11,87.66ZM46.47,98.47L46.47,52.2c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h45.95v5.4L51.83,52.2L51.83,98.47ZM101.89,108.01L62.56,108.01c-1.43,0 -2.68,-0.54 -3.75,-1.62 -1.07,-1.08 -1.61,-2.34 -1.61,-3.78L57.2,63c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h39.33c1.43,0 2.68,0.54 3.75,1.62 1.07,1.08 1.61,2.34 1.61,3.78v39.61c0,1.44 -0.54,2.7 -1.61,3.78 -1.07,1.08 -2.32,1.62 -3.75,1.62zM101.89,102.61L101.89,63L62.56,63L62.56,102.61ZM62.56,63v39.61z"
android:strokeWidth="1"
android:fillColor="#120807"/>
</vector>