Skip to content

Commit 29bcf94

Browse files
authored
Merge pull request #6051 from TeamNewPipe/bandcamp_segments
[Bandcamp] Add Radio stream segments
2 parents dd68bf8 + e5457e5 commit 29bcf94

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ dependencies {
180180
/** NewPipe libraries **/
181181
// You can use a local version by uncommenting a few lines in settings.gradle
182182
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
183-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:55e0f8e725e45f06513d43875fee6644ea9a8066'
183+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:82d11386df42567959d6afc35a856fb9ee1e1327'
184184

185185
/** Checkstyle **/
186186
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"

app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentItem.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.info_list
22

3+
import android.view.View
34
import android.widget.ImageView
45
import android.widget.TextView
56
import com.nostra13.universalimageloader.core.ImageLoader
@@ -29,6 +30,17 @@ class StreamSegmentItem(
2930
)
3031
}
3132
viewHolder.root.findViewById<TextView>(R.id.textViewTitle).text = item.title
33+
if (item.channelName == null) {
34+
viewHolder.root.findViewById<TextView>(R.id.textViewChannel).visibility = View.GONE
35+
// When the channel name is displayed there is less space
36+
// and thus the segment title needs to be only one line height.
37+
// But when there is no channel name displayed, the title can be two lines long.
38+
// The default maxLines value is set to 1 to display all elements in the AS preview,
39+
viewHolder.root.findViewById<TextView>(R.id.textViewTitle).maxLines = 2
40+
} else {
41+
viewHolder.root.findViewById<TextView>(R.id.textViewChannel).text = item.channelName
42+
viewHolder.root.findViewById<TextView>(R.id.textViewChannel).visibility = View.VISIBLE
43+
}
3244
viewHolder.root.findViewById<TextView>(R.id.textViewStartSeconds).text =
3345
Localization.getDurationString(item.startTimeSeconds.toLong())
3446
viewHolder.root.setOnClickListener { onClick.onItemClick(this, item.startTimeSeconds) }

app/src/main/res/layout/item_stream_segment.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,29 @@
4141
android:layout_width="match_parent"
4242
android:layout_height="wrap_content"
4343
android:ellipsize="end"
44-
android:maxLines="2"
44+
android:maxLines="1"
4545
android:textAppearance="@style/PlayQueueItemTitle"
4646
android:textSize="@dimen/video_item_search_title_text_size"
47-
app:layout_constraintStart_toStartOf="parent"
48-
app:layout_constraintTop_toTopOf="parent"
4947
tools:text="Lorem ipusum is widely used to create long sample text which is used here too" />
5048

49+
<TextView
50+
android:id="@+id/textViewChannel"
51+
android:layout_width="match_parent"
52+
android:layout_height="wrap_content"
53+
android:ellipsize="end"
54+
android:maxLines="1"
55+
android:textAppearance="@style/PlayQueueItemSubtitle"
56+
android:textSize="@dimen/video_item_search_title_text_size"
57+
58+
tools:text="Lorem ipsum creator" />
59+
5160
<TextView
5261
android:id="@+id/textViewStartSeconds"
5362
android:layout_width="match_parent"
5463
android:layout_height="wrap_content"
5564
android:layout_marginTop="2dp"
5665
android:textAppearance="@style/PlayQueueItemSubtitle"
5766
android:textSize="@dimen/video_item_search_upload_date_text_size"
58-
app:layout_constraintStart_toStartOf="parent"
59-
app:layout_constraintTop_toBottomOf="@id/textViewTitle"
6067
tools:text="04:26" />
6168

6269
</LinearLayout>

0 commit comments

Comments
 (0)