From e5457e5029911580f3c293541c69ef8b44e2ea2f Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 11 Apr 2021 23:14:18 +0200 Subject: [PATCH] [Bandcamp] Add Radio stream segments Display channel / creator / artist name when given --- app/build.gradle | 2 +- .../newpipe/info_list/StreamSegmentItem.kt | 12 ++++++++++++ app/src/main/res/layout/item_stream_segment.xml | 17 ++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bbf75063b..3d6e0ae5d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -180,7 +180,7 @@ dependencies { /** NewPipe libraries **/ // You can use a local version by uncommenting a few lines in settings.gradle implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' - implementation 'com.github.TeamNewPipe:NewPipeExtractor:55e0f8e725e45f06513d43875fee6644ea9a8066' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:82d11386df42567959d6afc35a856fb9ee1e1327' /** Checkstyle **/ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" diff --git a/app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentItem.kt b/app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentItem.kt index 798b9b287..f6d3587d6 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentItem.kt +++ b/app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentItem.kt @@ -1,5 +1,6 @@ package org.schabi.newpipe.info_list +import android.view.View import android.widget.ImageView import android.widget.TextView import com.nostra13.universalimageloader.core.ImageLoader @@ -29,6 +30,17 @@ class StreamSegmentItem( ) } viewHolder.root.findViewById(R.id.textViewTitle).text = item.title + if (item.channelName == null) { + viewHolder.root.findViewById(R.id.textViewChannel).visibility = View.GONE + // When the channel name is displayed there is less space + // and thus the segment title needs to be only one line height. + // But when there is no channel name displayed, the title can be two lines long. + // The default maxLines value is set to 1 to display all elements in the AS preview, + viewHolder.root.findViewById(R.id.textViewTitle).maxLines = 2 + } else { + viewHolder.root.findViewById(R.id.textViewChannel).text = item.channelName + viewHolder.root.findViewById(R.id.textViewChannel).visibility = View.VISIBLE + } viewHolder.root.findViewById(R.id.textViewStartSeconds).text = Localization.getDurationString(item.startTimeSeconds.toLong()) viewHolder.root.setOnClickListener { onClick.onItemClick(this, item.startTimeSeconds) } diff --git a/app/src/main/res/layout/item_stream_segment.xml b/app/src/main/res/layout/item_stream_segment.xml index a9eba0e85..a45565bb8 100644 --- a/app/src/main/res/layout/item_stream_segment.xml +++ b/app/src/main/res/layout/item_stream_segment.xml @@ -41,13 +41,22 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="end" - android:maxLines="2" + android:maxLines="1" android:textAppearance="@style/PlayQueueItemTitle" android:textSize="@dimen/video_item_search_title_text_size" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" tools:text="Lorem ipusum is widely used to create long sample text which is used here too" /> + +