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

View File

@ -943,6 +943,8 @@ class PlayerFragment : BaseFragment() {
playerTitle.text = response.title playerTitle.text = response.title
playerDescription.text = response.description 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 // duration that's not greater than 0 indicates that the video is live

View File

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