mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-21 03:54:46 +00:00
Hide playlist video count if unknown
This commit is contained in:
parent
486ebd6bc8
commit
843e746968
6 changed files with 25 additions and 8 deletions
|
@ -436,7 +436,7 @@ class PlatformPlaylist extends PlatformContent {
|
|||
constructor(obj) {
|
||||
super(obj, 4);
|
||||
this.plugin_type = "PlatformPlaylist";
|
||||
this.videoCount = obj.videoCount ?? 0;
|
||||
this.videoCount = obj.videoCount ?? -1;
|
||||
this.thumbnail = obj.thumbnail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ open class JSPlaylist : JSContent, IPlatformPlaylist {
|
|||
constructor(config: SourcePluginConfig, obj: V8ValueObject) : super(config, obj) {
|
||||
val contextName = "Playlist";
|
||||
thumbnail = obj.getOrDefault(config, "thumbnail", contextName, null);
|
||||
videoCount = obj.getOrDefault(config, "videoCount", contextName, 0)!!;
|
||||
videoCount = obj.getOrDefault(config, "videoCount", contextName, -1)!!;
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ open class PlaylistView : LinearLayout {
|
|||
protected val _platformIndicator: PlatformIndicator;
|
||||
protected val _textPlaylistName: TextView
|
||||
protected val _textVideoCount: TextView
|
||||
protected val _textVideoCountLabel: TextView;
|
||||
protected val _textPlaylistItems: TextView
|
||||
protected val _textChannelName: TextView
|
||||
protected var _neopassAnimator: ObjectAnimator? = null;
|
||||
|
@ -62,6 +63,7 @@ open class PlaylistView : LinearLayout {
|
|||
_platformIndicator = findViewById(R.id.thumbnail_platform);
|
||||
_textPlaylistName = findViewById(R.id.text_playlist_name);
|
||||
_textVideoCount = findViewById(R.id.text_video_count);
|
||||
_textVideoCountLabel = findViewById(R.id.text_video_count_label);
|
||||
_textChannelName = findViewById(R.id.text_channel_name);
|
||||
_textPlaylistItems = findViewById(R.id.text_playlist_items);
|
||||
_imageNeopassChannel = findViewById(R.id.image_neopass_channel);
|
||||
|
@ -137,7 +139,15 @@ open class PlaylistView : LinearLayout {
|
|||
.crossfade()
|
||||
.into(_imageThumbnail);
|
||||
|
||||
_textVideoCount.text = content.videoCount.toString();
|
||||
if(content.videoCount >= 0) {
|
||||
_textVideoCount.text = content.videoCount.toString();
|
||||
_textVideoCount.visibility = View.VISIBLE;
|
||||
_textVideoCountLabel.visibility = VISIBLE;
|
||||
}
|
||||
else {
|
||||
_textVideoCount.visibility = View.GONE;
|
||||
_textVideoCountLabel.visibility = GONE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentPlaylist = null;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.futo.platformplayer.views.adapters.viewholders
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
|
@ -46,7 +47,12 @@ class ImportPlaylistsViewHolder(private val _viewGroup: ViewGroup) : AnyAdapter.
|
|||
|
||||
override fun bind(value: SelectablePlaylist) {
|
||||
_textName.text = value.playlist.name;
|
||||
_textMetadata.text = "${value.playlist.videoCount} " + _view.context.getString(R.string.videos);
|
||||
if(value.playlist.videoCount >= 0) {
|
||||
_textMetadata.text = "${value.playlist.videoCount} " + _view.context.getString(R.string.videos);
|
||||
_textMetadata.visibility = View.VISIBLE;
|
||||
}
|
||||
else
|
||||
_textMetadata.visibility = View.GONE;
|
||||
_checkbox.value = value.selected;
|
||||
|
||||
val thumbnail = value.playlist.thumbnail;
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
android:textColor="@color/gray_7f"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_video_count_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="8dp"
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
android:fontFamily="@font/inter_light"
|
||||
tools:text="100"
|
||||
android:textColor="@color/gray_7f"
|
||||
app:layout_constraintRight_toLeftOf="@id/text_videos"
|
||||
app:layout_constraintBottom_toBottomOf="@id/text_videos" />
|
||||
app:layout_constraintRight_toLeftOf="@id/text_video_count_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/text_video_count_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_playlist"
|
||||
|
@ -80,10 +80,10 @@
|
|||
android:textColor="@color/gray_e0"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_videos"/>
|
||||
app:layout_constraintBottom_toTopOf="@id/text_video_count_label"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_videos"
|
||||
android:id="@+id/text_video_count_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12dp"
|
||||
|
|
Loading…
Add table
Reference in a new issue