From 900aa3d9ee972bd476c6c7c3a340420f89cb72e9 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 15 May 2022 16:03:38 +0200 Subject: [PATCH] Fixed slow Picasso Image Loading --- .../java/com/github/libretube/adapters/SearchAdapter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt index 077fac1ad..be951287d 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -59,11 +59,11 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ private fun bindWatch(item: SearchItem) { val thumbnailImage = v.findViewById(R.id.search_thumbnail) - Picasso.get().load(item.thumbnail).into(thumbnailImage) + Picasso.get().load(item.thumbnail).fit().centerCrop().into(thumbnailImage) val thumbnailDuration = v.findViewById(R.id.search_thumbnail_duration) thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!) val channelImage = v.findViewById(R.id.search_channel_image) - Picasso.get().load(item.uploaderAvatar).into(channelImage) + Picasso.get().load(item.uploaderAvatar).fit().centerCrop().into(channelImage) val title = v.findViewById(R.id.search_description) if (item.title!!.length > 60) { title.text = item.title?.substring(0, 60) + "..." @@ -95,7 +95,7 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ } private fun bindChannel(item: SearchItem) { val channelImage = v.findViewById(R.id.search_channel_image) - Picasso.get().load(item.thumbnail).into(channelImage) + Picasso.get().load(item.thumbnail).fit().centerCrop().into(channelImage) val channelName = v.findViewById(R.id.search_channel_name) channelName.text = item.name val channelViews = v.findViewById(R.id.search_views) @@ -109,7 +109,7 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ } private fun bindPlaylist(item: SearchItem) { val playlistImage = v.findViewById(R.id.search_thumbnail) - Picasso.get().load(item.thumbnail).into(playlistImage) + Picasso.get().load(item.thumbnail).fit().centerCrop().into(playlistImage) val playlistNumber = v.findViewById(R.id.search_playlist_number) playlistNumber.text = item.videos.toString() val playlistName = v.findViewById(R.id.search_description)