mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Fixed null and -1 strings
This commit is contained in:
parent
af62aa7df2
commit
fef5589534
@ -65,13 +65,11 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
|
||||
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
|
||||
Picasso.get().load(item.uploaderAvatar).fit().centerCrop().into(channelImage)
|
||||
val title = v.findViewById<TextView>(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<TextView>(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<TextView>(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<ImageView>(R.id.search_thumbnail)
|
||||
Picasso.get().load(item.thumbnail).fit().centerCrop().into(playlistImage)
|
||||
val playlistNumber = v.findViewById<TextView>(R.id.search_playlist_number)
|
||||
playlistNumber.text = item.videos.toString()
|
||||
if (item.videos?.toInt() != -1) playlistNumber.text = item.videos.toString()
|
||||
val playlistName = v.findViewById<TextView>(R.id.search_description)
|
||||
playlistName.text = item.name
|
||||
val playlistChannelName = v.findViewById<TextView>(R.id.search_name)
|
||||
playlistChannelName.text = item.uploaderName
|
||||
val playlistVideosNumber = v.findViewById<TextView>(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
|
||||
|
@ -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" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_playlist"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_below="@+id/search_playlist_number"
|
||||
/>
|
||||
android:layout_centerInParent="true"
|
||||
app:srcCompat="@drawable/ic_playlist" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@ -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"
|
||||
|
@ -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" />
|
||||
|
@ -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" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user