mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-10-26 17:24:33 +00:00
Apply Description changes
This commit is contained in:
1 parent
9f745a0b81
commit
c36e660c52
10 files changed
+21
-21
No files matched your search
@@ -105,7 +105,7 @@ public abstract class BaseDescriptionFragment extends BaseFragment {
|
||||
|
||||
private void setupDescription() {
|
||||
final Description description = getDescription();
|
||||
if (description == null || isEmpty(description.getContent())
|
||||
if (description == null || isEmpty(description.content())
|
||||
|| description == Description.EMPTY_DESCRIPTION) {
|
||||
binding.detailDescriptionView.setVisibility(View.GONE);
|
||||
binding.detailSelectDescriptionButton.setVisibility(View.GONE);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class ChannelAboutFragment extends BaseDescriptionFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Description getDescription() {
|
||||
return new Description(channelInfo.getDescription(), Description.PLAIN_TEXT);
|
||||
return new Description(channelInfo.getDescription(), Description.Type.PLAIN_TEXT);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -330,7 +330,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||
|
||||
final Description description = result.getDescription();
|
||||
if (description != null && description != Description.EMPTY_DESCRIPTION
|
||||
&& !isBlank(description.getContent())) {
|
||||
&& !isBlank(description.content())) {
|
||||
final TextEllipsizer ellipsizer = new TextEllipsizer(
|
||||
headerBinding.playlistDescription, 5, getServiceById(result.getServiceId()));
|
||||
ellipsizer.setStateChangeListener(isEllipsized ->
|
||||
|
||||
@@ -35,7 +35,7 @@ fun DescriptionText(
|
||||
fun rememberParsedDescription(description: Description): AnnotatedString {
|
||||
// TODO: Handle links and hashtags, Markdown.
|
||||
return remember(description) {
|
||||
if (description.type == Description.HTML) {
|
||||
if (description.type == Description.Type.HTML) {
|
||||
val styles = TextLinkStyles(SpanStyle(textDecoration = TextDecoration.Underline))
|
||||
AnnotatedString.fromHtml(description.content, styles)
|
||||
} else {
|
||||
|
||||
@@ -231,7 +231,7 @@ fun CommentsInfoItem(
|
||||
private class CommentPreviewProvider : CollectionPreviewParameterProvider<CommentsInfoItem>(
|
||||
listOf(
|
||||
CommentsInfoItem(
|
||||
commentText = Description("Hello world!\n\nThis line should be hidden by default.", Description.PLAIN_TEXT),
|
||||
commentText = Description("Hello world!\n\nThis line should be hidden by default.", Description.Type.PLAIN_TEXT),
|
||||
uploaderName = "Test",
|
||||
likeCount = 100,
|
||||
isPinned = false,
|
||||
@@ -241,7 +241,7 @@ private class CommentPreviewProvider : CollectionPreviewParameterProvider<Commen
|
||||
isEdited = false
|
||||
),
|
||||
CommentsInfoItem(
|
||||
commentText = Description("Hello world, long long long text lorem ipsum dolor sit amet!<br><br>This line should be hidden by default.", Description.HTML),
|
||||
commentText = Description("Hello world, long long long text lorem ipsum dolor sit amet!<br><br>This line should be hidden by default.", Description.Type.HTML),
|
||||
uploaderName = "Test",
|
||||
likeCount = 92847,
|
||||
isPinned = true,
|
||||
@@ -251,7 +251,7 @@ private class CommentPreviewProvider : CollectionPreviewParameterProvider<Commen
|
||||
isEdited = true
|
||||
),
|
||||
CommentsInfoItem(
|
||||
commentText = Description("Hello world, long long long text lorem ipsum dolor sit amet!<br><br>This line should be hidden by default.", Description.HTML),
|
||||
commentText = Description("Hello world, long long long text lorem ipsum dolor sit amet!<br><br>This line should be hidden by default.", Description.Type.HTML),
|
||||
uploaderName = "Test really long long long long lorem ipsum dolor sit amet consectetur",
|
||||
likeCount = 92847,
|
||||
isPinned = true,
|
||||
@@ -261,7 +261,7 @@ private class CommentPreviewProvider : CollectionPreviewParameterProvider<Commen
|
||||
isEdited = true
|
||||
),
|
||||
CommentsInfoItem(
|
||||
commentText = Description("Short comment", Description.HTML),
|
||||
commentText = Description("Short comment", Description.Type.HTML),
|
||||
uploaderName = "Test really long long long long lorem ipsum dolor sit amet consectetur",
|
||||
likeCount = 92847,
|
||||
isPinned = false,
|
||||
|
||||
+2
-2
@@ -159,7 +159,7 @@ private fun CommentRepliesDialog(
|
||||
@Composable
|
||||
private fun CommentRepliesDialogPreview() {
|
||||
val comment = CommentsInfoItem(
|
||||
commentText = Description("Hello world!", Description.PLAIN_TEXT),
|
||||
commentText = Description("Hello world!", Description.Type.PLAIN_TEXT),
|
||||
uploaderName = "Test",
|
||||
likeCount = 100,
|
||||
isPinned = true,
|
||||
@@ -169,7 +169,7 @@ private fun CommentRepliesDialogPreview() {
|
||||
CommentsInfoItem(
|
||||
commentText = Description(
|
||||
"Reply $i: ${LoremIpsum(i * i).values.first()}",
|
||||
Description.PLAIN_TEXT
|
||||
Description.Type.PLAIN_TEXT
|
||||
),
|
||||
uploaderName = LoremIpsum(11 - i).values.first()
|
||||
)
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ fun CommentRepliesHeader(comment: CommentsInfoItem, onCommentAuthorOpened: () ->
|
||||
@Composable
|
||||
fun CommentRepliesHeaderPreview() {
|
||||
val comment = CommentsInfoItem(
|
||||
commentText = Description(LoremIpsum(50).values.first(), Description.PLAIN_TEXT),
|
||||
commentText = Description(LoremIpsum(50).values.first(), Description.Type.PLAIN_TEXT),
|
||||
uploaderName = "Test really long lorem ipsum dolor sit",
|
||||
likeCount = 1000,
|
||||
isPinned = true,
|
||||
|
||||
@@ -219,7 +219,7 @@ private fun CommentSectionSuccessPreview() {
|
||||
CommentsInfoItem(
|
||||
commentText = Description(
|
||||
"Comment 1\n\nThis line should be hidden by default.",
|
||||
Description.PLAIN_TEXT
|
||||
Description.Type.PLAIN_TEXT
|
||||
),
|
||||
uploaderName = "Test",
|
||||
replies = Page(""),
|
||||
@@ -227,7 +227,7 @@ private fun CommentSectionSuccessPreview() {
|
||||
)
|
||||
) + (2..10).map {
|
||||
CommentsInfoItem(
|
||||
commentText = Description("Comment $it", Description.PLAIN_TEXT),
|
||||
commentText = Description("Comment $it", Description.Type.PLAIN_TEXT),
|
||||
uploaderName = "Test"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public final class ExtractorHelper {
|
||||
.append(Localization.DOT_SEPARATOR);
|
||||
}
|
||||
|
||||
String content = metaInfo.getContent().getContent().trim();
|
||||
String content = metaInfo.getContent().content().trim();
|
||||
if (content.endsWith(".")) {
|
||||
content = content.substring(0, content.length() - 1); // remove . at end
|
||||
}
|
||||
|
||||
@@ -67,17 +67,17 @@ public final class TextLinkifier {
|
||||
@Nullable final String relatedStreamUrl,
|
||||
@NonNull final CompositeDisposable disposables,
|
||||
@Nullable final Consumer<TextView> onCompletion) {
|
||||
switch (description.getType()) {
|
||||
case Description.HTML:
|
||||
TextLinkifier.fromHtml(textView, description.getContent(), htmlCompatFlag,
|
||||
switch (description.type()) {
|
||||
case Description.Type.HTML:
|
||||
TextLinkifier.fromHtml(textView, description.content(), htmlCompatFlag,
|
||||
relatedInfoService, relatedStreamUrl, disposables, onCompletion);
|
||||
break;
|
||||
case Description.MARKDOWN:
|
||||
TextLinkifier.fromMarkdown(textView, description.getContent(),
|
||||
case Description.Type.MARKDOWN:
|
||||
TextLinkifier.fromMarkdown(textView, description.content(),
|
||||
relatedInfoService, relatedStreamUrl, disposables, onCompletion);
|
||||
break;
|
||||
case Description.PLAIN_TEXT: default:
|
||||
TextLinkifier.fromPlainText(textView, description.getContent(),
|
||||
case Description.Type.PLAIN_TEXT: default:
|
||||
TextLinkifier.fromPlainText(textView, description.content(),
|
||||
relatedInfoService, relatedStreamUrl, disposables, onCompletion);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user