|
1 | 1 | package org.schabi.newpipe.fragments.list.playlist; |
2 | 2 |
|
| 3 | +import static org.schabi.newpipe.extractor.utils.Utils.isBlank; |
3 | 4 | import static org.schabi.newpipe.ktx.ViewUtils.animate; |
4 | 5 | import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingScrolling; |
| 6 | +import static org.schabi.newpipe.util.text.TextLinkifier.SET_LINK_MOVEMENT_METHOD; |
5 | 7 |
|
6 | 8 | import android.content.Context; |
7 | 9 | import android.os.Bundle; |
|
17 | 19 | import androidx.annotation.NonNull; |
18 | 20 | import androidx.annotation.Nullable; |
19 | 21 | import androidx.appcompat.content.res.AppCompatResources; |
| 22 | +import androidx.core.text.HtmlCompat; |
20 | 23 |
|
21 | 24 | import com.google.android.material.shape.CornerFamily; |
22 | 25 | import com.google.android.material.shape.ShapeAppearanceModel; |
|
37 | 40 | import org.schabi.newpipe.extractor.ServiceList; |
38 | 41 | import org.schabi.newpipe.extractor.playlist.PlaylistInfo; |
39 | 42 | import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper; |
| 43 | +import org.schabi.newpipe.extractor.stream.Description; |
40 | 44 | import org.schabi.newpipe.extractor.stream.StreamInfoItem; |
41 | 45 | import org.schabi.newpipe.fragments.list.BaseListInfoFragment; |
42 | 46 | import org.schabi.newpipe.info_list.dialog.InfoItemDialog; |
|
51 | 55 | import org.schabi.newpipe.util.image.PicassoHelper; |
52 | 56 | import org.schabi.newpipe.util.external_communication.ShareUtils; |
53 | 57 | import org.schabi.newpipe.util.PlayButtonHelper; |
| 58 | +import org.schabi.newpipe.util.text.TextLinkifier; |
54 | 59 |
|
55 | 60 | import java.util.ArrayList; |
56 | 61 | import java.util.List; |
@@ -321,6 +326,18 @@ public void handleResult(@NonNull final PlaylistInfo result) { |
321 | 326 | headerBinding.playlistStreamCount.setText(Localization |
322 | 327 | .localizeStreamCount(getContext(), result.getStreamCount())); |
323 | 328 |
|
| 329 | + final Description description = result.getDescription(); |
| 330 | + if (description != null && description != Description.EMPTY_DESCRIPTION |
| 331 | + && !isBlank(description.getContent())) { |
| 332 | + TextLinkifier.fromDescription(headerBinding.playlistDescription, |
| 333 | + description, HtmlCompat.FROM_HTML_MODE_LEGACY, |
| 334 | + result.getService(), result.getUrl(), |
| 335 | + disposables, SET_LINK_MOVEMENT_METHOD); |
| 336 | + headerBinding.playlistDescription.setVisibility(View.VISIBLE); |
| 337 | + } else { |
| 338 | + headerBinding.playlistDescription.setVisibility(View.GONE); |
| 339 | + } |
| 340 | + |
324 | 341 | if (!result.getErrors().isEmpty()) { |
325 | 342 | showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.REQUESTED_PLAYLIST, |
326 | 343 | result.getUrl(), result)); |
|
0 commit comments