Merge pull request #1512 from Bnyro/master

show the subscriptions count in the channel fragment
This commit is contained in:
Bnyro 2022-10-07 18:56:11 +02:00 committed by GitHub
commit 0ebf1b13c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 43 deletions

View File

@ -4,31 +4,27 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class Streams(
val title: String?,
val description: String?,
val uploadDate: String?,
val uploader: String?,
val uploaderUrl: String?,
val uploaderAvatar: String?,
val thumbnailUrl: String?,
val hls: String?,
val dash: String?,
val lbryId: String?,
val uploaderVerified: Boolean?,
val duration: Long?,
val views: Long?,
val likes: Long?,
val dislikes: Long?,
val audioStreams: List<com.github.libretube.api.obj.PipedStream>?,
val videoStreams: List<com.github.libretube.api.obj.PipedStream>?,
val relatedStreams: List<com.github.libretube.api.obj.StreamItem>?,
val subtitles: List<com.github.libretube.api.obj.Subtitle>?,
val livestream: Boolean?,
val proxyUrl: String?,
val chapters: List<com.github.libretube.api.obj.ChapterSegment>?
) {
constructor() : this(
"", "", "", "", "", "", "", "", "", "", null, -1, -1, -1, -1, emptyList(), emptyList(),
emptyList(), emptyList(), null, "", emptyList()
)
}
val title: String? = null,
val description: String? = null,
val uploadDate: String? = null,
val uploader: String? = null,
val uploaderUrl: String? = null,
val uploaderAvatar: String? = null,
val thumbnailUrl: String? = null,
val hls: String? = null,
val dash: String? = null,
val lbryId: String? = null,
val uploaderVerified: Boolean? = null,
val duration: Long? = null,
val views: Long? = null,
val likes: Long? = null,
val dislikes: Long? = null,
val audioStreams: List<PipedStream>? = null,
val videoStreams: List<PipedStream>? = null,
val relatedStreams: List<StreamItem>? = null,
val subtitles: List<Subtitle>? = null,
val livestream: Boolean? = null,
val proxyUrl: String? = null,
val chapters: List<ChapterSegment>? = null,
val uploaderSubscriberCount: Long? = null
)

View File

@ -943,6 +943,8 @@ class PlayerFragment : BaseFragment() {
playerTitle.text = response.title
playerDescription.text = response.description
playerChannelSubCount.text = context?.getString(R.string.subscribers, response.uploaderSubscriberCount?.formatShort())
}
// duration that's not greater than 0 indicates that the video is live

View File

@ -181,7 +181,8 @@
android:autoSizeTextType="uniform"
android:gravity="center"
android:maxLines="1"
android:text="@string/download" />
android:text="@string/download"
tools:targetApi="o" />
</LinearLayout>
<LinearLayout
@ -235,7 +236,7 @@
</com.google.android.material.card.MaterialCardView>
<RelativeLayout
<LinearLayout
android:id="@+id/player_channel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -244,6 +245,7 @@
android:layout_marginEnd="8dp"
android:layout_marginBottom="15dp"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="8dp">
@ -251,34 +253,50 @@
android:id="@+id/player_channelImage"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginEnd="4dp" />
<TextView
android:id="@+id/player_channelName"
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
android:layout_toStartOf="@+id/player_subscribe"
android:layout_toEndOf="@+id/player_channelImage"
android:ellipsize="end"
android:maxLines="1"
android:textSize="15sp" />
android:orientation="vertical">
<TextView
android:id="@+id/player_channelName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="15sp" />
<TextView
android:id="@+id/player_channelSubCount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="11sp"
tools:text="2.5M" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/player_subscribe"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:text="@string/subscribe"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
app:cornerRadius="11dp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout