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 be951287d..71e431041 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -65,13 +65,11 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ val channelImage = v.findViewById(R.id.search_channel_image) 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) + "..." - } else { - title.text = item.title - } + title.text = if (item.title!!.length > 60) item.title?.substring(0, 60) + "..." else item.title val views = v.findViewById(R.id.search_views) - views.text = item.views.formatShort() +" • "+item.uploadedDate + val viewsString = if (item.views?.toInt() != -1) item.views.formatShort() else "" + val uploadDate = if (item.uploadedDate != null) item.uploadedDate else "" + views.text = if (viewsString != "" && uploadDate != "") viewsString + " • " + uploadDate else viewsString + uploadDate val channelName = v.findViewById(R.id.search_channel_name) channelName.text = item.uploaderName v.setOnClickListener{ @@ -111,13 +109,13 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ val playlistImage = v.findViewById(R.id.search_thumbnail) Picasso.get().load(item.thumbnail).fit().centerCrop().into(playlistImage) val playlistNumber = v.findViewById(R.id.search_playlist_number) - playlistNumber.text = item.videos.toString() + if (item.videos?.toInt() != -1) playlistNumber.text = item.videos.toString() val playlistName = v.findViewById(R.id.search_description) playlistName.text = item.name val playlistChannelName = v.findViewById(R.id.search_name) playlistChannelName.text = item.uploaderName val playlistVideosNumber = v.findViewById(R.id.search_playlist_videos) - playlistVideosNumber.text = item.videos.toString()+" videos" + if (item.videos?.toInt() != -1) playlistVideosNumber.text = v.context.getString(R.string.videoCount, item.videos.toString()) v.setOnClickListener { //playlist clicked val activity = v.context as MainActivity diff --git a/app/src/main/res/layout/playlist_search_row.xml b/app/src/main/res/layout/playlist_search_row.xml index a4d451b23..2b3eb1086 100644 --- a/app/src/main/res/layout/playlist_search_row.xml +++ b/app/src/main/res/layout/playlist_search_row.xml @@ -43,21 +43,17 @@ android:id="@+id/search_playlist_number" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="10" - android:textColor="#ECE4E4" + android:layout_centerInParent="true" android:layout_centerVertical="true" - android:layout_centerHorizontal="true" - /> + android:textColor="#ECE4E4" /> + android:layout_centerInParent="true" + app:srcCompat="@drawable/ic_playlist" /> @@ -67,7 +63,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_playlist" app:layout_constraintTop_toTopOf="parent" /> @@ -77,7 +72,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_playlist" app:layout_constraintTop_toBottomOf="@+id/search_description" /> @@ -86,7 +80,6 @@ android:id="@+id/search_playlist_videos" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="TextView" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/guideline" diff --git a/app/src/main/res/layout/video_channel_row.xml b/app/src/main/res/layout/video_channel_row.xml index 6835d1997..ad74d023b 100644 --- a/app/src/main/res/layout/video_channel_row.xml +++ b/app/src/main/res/layout/video_channel_row.xml @@ -50,7 +50,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintTop_toTopOf="parent" /> @@ -60,7 +59,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintTop_toBottomOf="@+id/channel_description" /> diff --git a/app/src/main/res/layout/video_search_row.xml b/app/src/main/res/layout/video_search_row.xml index 444473b2e..5d26d04b3 100644 --- a/app/src/main/res/layout/video_search_row.xml +++ b/app/src/main/res/layout/video_search_row.xml @@ -53,7 +53,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintTop_toTopOf="parent" /> @@ -63,7 +62,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintTop_toBottomOf="@+id/search_description" /> @@ -83,7 +81,6 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="12dp" - android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/search_channel_image" app:layout_constraintTop_toBottomOf="@+id/search_views" />