mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Fix post content is not parsed in other types of posts.
This commit is contained in:
parent
97dcc263e3
commit
633ccc7f7d
@ -108,7 +108,6 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottom
|
|||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
|
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
|
|
||||||
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
||||||
import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment;
|
import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment;
|
||||||
import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
|
import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
|
||||||
@ -657,6 +656,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
|
||||||
|
((PostDetailBaseViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
|
||||||
|
((PostDetailBaseViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
|
||||||
|
mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
|
||||||
|
mMarkwonAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
if (holder instanceof PostDetailVideoAutoplayViewHolder) {
|
if (holder instanceof PostDetailVideoAutoplayViewHolder) {
|
||||||
((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE);
|
((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE);
|
||||||
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
||||||
@ -752,7 +758,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
||||||
loadImage((PostDetailLinkViewHolder) holder, preview);
|
loadImage((PostDetailLinkViewHolder) holder, preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (holder instanceof PostDetailNoPreviewViewHolder) {
|
} else if (holder instanceof PostDetailNoPreviewViewHolder) {
|
||||||
if (mPost.getPostType() == Post.LINK_TYPE || mPost.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
if (mPost.getPostType() == Post.LINK_TYPE || mPost.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
||||||
if (!mHidePostType) {
|
if (!mHidePostType) {
|
||||||
@ -791,25 +796,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
|
|
||||||
((PostDetailNoPreviewViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
|
|
||||||
LinearLayoutManagerBugFixed linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
|
|
||||||
@Override
|
|
||||||
public void onScrolledLeft() {
|
|
||||||
((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScrolledRight() {
|
|
||||||
((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
((PostDetailNoPreviewViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
|
|
||||||
((PostDetailNoPreviewViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
|
|
||||||
mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
|
|
||||||
mMarkwonAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
} else if (holder instanceof PostDetailGalleryViewHolder) {
|
} else if (holder instanceof PostDetailGalleryViewHolder) {
|
||||||
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
||||||
if (preview != null) {
|
if (preview != null) {
|
||||||
@ -823,25 +809,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
} else {
|
} else {
|
||||||
((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE);
|
((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else if (holder instanceof PostDetailTextViewHolder) {
|
|
||||||
if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
|
|
||||||
((PostDetailTextViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
|
|
||||||
LinearLayoutManagerBugFixed linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
|
|
||||||
@Override
|
|
||||||
public void onScrolledLeft() {
|
|
||||||
((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScrolledRight() {
|
|
||||||
((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
((PostDetailTextViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
|
|
||||||
((PostDetailTextViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
|
|
||||||
mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
|
|
||||||
mMarkwonAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,6 +1042,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.GONE);
|
((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.GONE);
|
||||||
((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE);
|
((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE);
|
||||||
((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
|
((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
|
||||||
|
((PostDetailBaseViewHolder) holder).mContentMarkdownView.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (holder instanceof PostDetailVideoAutoplayViewHolder) {
|
if (holder instanceof PostDetailVideoAutoplayViewHolder) {
|
||||||
if (((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall != null && !((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.isCanceled()) {
|
if (((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall != null && !((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.isCanceled()) {
|
||||||
@ -1137,6 +1105,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
CustomTextView mFlairTextView;
|
CustomTextView mFlairTextView;
|
||||||
TextView mAwardsTextView;
|
TextView mAwardsTextView;
|
||||||
TextView mUpvoteRatioTextView;
|
TextView mUpvoteRatioTextView;
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
ImageView mUpvoteButton;
|
ImageView mUpvoteButton;
|
||||||
TextView mScoreTextView;
|
TextView mScoreTextView;
|
||||||
@ -1164,6 +1133,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
CustomTextView mFlairTextView,
|
CustomTextView mFlairTextView,
|
||||||
TextView mAwardsTextView,
|
TextView mAwardsTextView,
|
||||||
TextView mUpvoteRatioTextView,
|
TextView mUpvoteRatioTextView,
|
||||||
|
RecyclerView mContentMarkdownView,
|
||||||
ConstraintLayout mBottomConstraintLayout,
|
ConstraintLayout mBottomConstraintLayout,
|
||||||
ImageView mUpvoteButton,
|
ImageView mUpvoteButton,
|
||||||
TextView mScoreTextView,
|
TextView mScoreTextView,
|
||||||
@ -1186,6 +1156,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
this.mFlairTextView = mFlairTextView;
|
this.mFlairTextView = mFlairTextView;
|
||||||
this.mAwardsTextView = mAwardsTextView;
|
this.mAwardsTextView = mAwardsTextView;
|
||||||
this.mUpvoteRatioTextView = mUpvoteRatioTextView;
|
this.mUpvoteRatioTextView = mUpvoteRatioTextView;
|
||||||
|
this.mContentMarkdownView = mContentMarkdownView;
|
||||||
this.mBottomConstraintLayout = mBottomConstraintLayout;
|
this.mBottomConstraintLayout = mBottomConstraintLayout;
|
||||||
this.mUpvoteButton = mUpvoteButton;
|
this.mUpvoteButton = mUpvoteButton;
|
||||||
this.mScoreTextView = mScoreTextView;
|
this.mScoreTextView = mScoreTextView;
|
||||||
@ -1250,6 +1221,18 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mContentMarkdownView.setLayoutManager(new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolledLeft() {
|
||||||
|
((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrolledRight() {
|
||||||
|
((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
mUpvoteButton.setOnClickListener(view -> {
|
mUpvoteButton.setOnClickListener(view -> {
|
||||||
if (mPost.isArchived()) {
|
if (mPost.isArchived()) {
|
||||||
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
@ -1627,6 +1610,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
ImageView muteButton;
|
ImageView muteButton;
|
||||||
@BindView(R.id.fullscreen_exo_playback_control_view)
|
@BindView(R.id.fullscreen_exo_playback_control_view)
|
||||||
ImageView fullscreenButton;
|
ImageView fullscreenButton;
|
||||||
|
@BindView(R.id.content_markdown_view_item_post_detail_video_autoplay)
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_autoplay)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_autoplay)
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
@BindView(R.id.plus_button_item_post_detail_video_autoplay)
|
@BindView(R.id.plus_button_item_post_detail_video_autoplay)
|
||||||
@ -1664,6 +1649,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -1873,6 +1859,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
ImageView videoOrGifIndicatorImageView;
|
ImageView videoOrGifIndicatorImageView;
|
||||||
@BindView(R.id.image_view_item_post_detail_video_and_gif_preview)
|
@BindView(R.id.image_view_item_post_detail_video_and_gif_preview)
|
||||||
AspectRatioGifImageView mImageView;
|
AspectRatioGifImageView mImageView;
|
||||||
|
@BindView(R.id.content_markdown_view_item_post_detail_video_and_gif_preview)
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview)
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
@BindView(R.id.plus_button_item_post_detail_video_and_gif_preview)
|
@BindView(R.id.plus_button_item_post_detail_video_and_gif_preview)
|
||||||
@ -1906,6 +1894,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -2000,6 +1989,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
TextView mLoadImageErrorTextView;
|
TextView mLoadImageErrorTextView;
|
||||||
@BindView(R.id.image_view_item_post_detail_image_and_gif_autoplay)
|
@BindView(R.id.image_view_item_post_detail_image_and_gif_autoplay)
|
||||||
AspectRatioGifImageView mImageView;
|
AspectRatioGifImageView mImageView;
|
||||||
|
@BindView(R.id.content_markdown_view_item_post_detail_image_and_gif_autoplay)
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_image_and_gif_autoplay)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_image_and_gif_autoplay)
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
@BindView(R.id.plus_button_item_post_detail_image_and_gif_autoplay)
|
@BindView(R.id.plus_button_item_post_detail_image_and_gif_autoplay)
|
||||||
@ -2033,6 +2024,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -2112,6 +2104,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
TextView mLoadImageErrorTextView;
|
TextView mLoadImageErrorTextView;
|
||||||
@BindView(R.id.image_view_item_post_detail_link)
|
@BindView(R.id.image_view_item_post_detail_link)
|
||||||
AspectRatioGifImageView mImageView;
|
AspectRatioGifImageView mImageView;
|
||||||
|
@BindView(R.id.content_markdown_view_item_post_detail_link)
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_link)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_link)
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
@BindView(R.id.plus_button_item_post_detail_link)
|
@BindView(R.id.plus_button_item_post_detail_link)
|
||||||
@ -2145,6 +2139,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -2240,6 +2235,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -2361,6 +2357,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
TextView mCaptionUrlTextView;
|
TextView mCaptionUrlTextView;
|
||||||
@BindView(R.id.image_view_no_preview_link_item_post_detail_gallery)
|
@BindView(R.id.image_view_no_preview_link_item_post_detail_gallery)
|
||||||
ImageView mNoPreviewPostTypeImageView;
|
ImageView mNoPreviewPostTypeImageView;
|
||||||
|
@BindView(R.id.content_markdown_view_item_post_detail_gallery)
|
||||||
|
RecyclerView mContentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_gallery)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_gallery)
|
||||||
ConstraintLayout mBottomConstraintLayout;
|
ConstraintLayout mBottomConstraintLayout;
|
||||||
@BindView(R.id.plus_button_item_post_detail_gallery)
|
@BindView(R.id.plus_button_item_post_detail_gallery)
|
||||||
@ -2394,6 +2392,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
@ -2493,6 +2492,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mFlairTextView,
|
mFlairTextView,
|
||||||
mAwardsTextView,
|
mAwardsTextView,
|
||||||
mUpvoteRatioTextView,
|
mUpvoteRatioTextView,
|
||||||
|
mContentMarkdownView,
|
||||||
mBottomConstraintLayout,
|
mBottomConstraintLayout,
|
||||||
mUpvoteButton,
|
mUpvoteButton,
|
||||||
mScoreTextView,
|
mScoreTextView,
|
||||||
|
@ -267,35 +267,8 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType,
|
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType,
|
||||||
voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw,
|
voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw,
|
||||||
stickied, archived, locked, saved, isCrosspost);
|
stickied, archived, locked, saved, isCrosspost);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
|
||||||
post.setSelfText("");
|
|
||||||
} else {
|
|
||||||
String selfText = Utils.modifyMarkdown(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
|
||||||
post.setSelfText(selfText);
|
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
|
||||||
post.setSelfTextPlainTrimmed("");
|
|
||||||
} else {
|
|
||||||
String selfTextPlain = Utils.trimTrailingWhitespace(
|
|
||||||
Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY))).toString();
|
|
||||||
post.setSelfTextPlain(selfTextPlain);
|
|
||||||
if (selfTextPlain.length() > 250) {
|
|
||||||
selfTextPlain = selfTextPlain.substring(0, 250);
|
|
||||||
}
|
|
||||||
if (!selfText.equals("")) {
|
|
||||||
Pattern p = Pattern.compile(">!.+!<");
|
|
||||||
Matcher m = p.matcher(selfText.substring(0, Math.min(selfText.length(), 400)));
|
|
||||||
if (m.find()) {
|
|
||||||
post.setSelfTextPlainTrimmed("");
|
|
||||||
} else {
|
|
||||||
post.setSelfTextPlainTrimmed(selfTextPlain);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
post.setSelfTextPlainTrimmed(selfTextPlain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (url.endsWith("jpg") || url.endsWith("png")) {
|
if (url.endsWith("jpg") || url.endsWith("png") || url.endsWith("jpeg")) {
|
||||||
//Image post
|
//Image post
|
||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
@ -496,34 +469,6 @@ public class ParsePost {
|
|||||||
|
|
||||||
//Need attention
|
//Need attention
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
|
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
|
||||||
post.setSelfText("");
|
|
||||||
} else {
|
|
||||||
String selfText = Utils.modifyMarkdown(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
|
||||||
post.setSelfText(selfText);
|
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
|
||||||
post.setSelfTextPlainTrimmed("");
|
|
||||||
} else {
|
|
||||||
String selfTextPlain = Utils.trimTrailingWhitespace(
|
|
||||||
Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY))).toString();
|
|
||||||
post.setSelfTextPlain(selfTextPlain);
|
|
||||||
if (selfTextPlain.length() > 250) {
|
|
||||||
selfTextPlain = selfTextPlain.substring(0, 250);
|
|
||||||
}
|
|
||||||
if (!selfText.equals("")) {
|
|
||||||
Pattern p = Pattern.compile(">!.+!<");
|
|
||||||
Matcher m = p.matcher(selfText.substring(0, Math.min(selfText.length(), 400)));
|
|
||||||
if (m.find()) {
|
|
||||||
post.setSelfTextPlainTrimmed("");
|
|
||||||
} else {
|
|
||||||
post.setSelfTextPlainTrimmed(selfTextPlain);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
post.setSelfTextPlainTrimmed(selfTextPlain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//Link post
|
//Link post
|
||||||
int postType = Post.LINK_TYPE;
|
int postType = Post.LINK_TYPE;
|
||||||
@ -747,6 +692,36 @@ public class ParsePost {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (post.getPostType() != Post.LINK_TYPE && post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
|
||||||
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
|
post.setSelfText("");
|
||||||
|
} else {
|
||||||
|
String selfText = Utils.modifyMarkdown(data.getString(JSONUtils.SELFTEXT_KEY).trim());
|
||||||
|
post.setSelfText(selfText);
|
||||||
|
if (data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||||
|
post.setSelfTextPlainTrimmed("");
|
||||||
|
} else {
|
||||||
|
String selfTextPlain = Utils.trimTrailingWhitespace(
|
||||||
|
Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY))).toString();
|
||||||
|
post.setSelfTextPlain(selfTextPlain);
|
||||||
|
if (selfTextPlain.length() > 250) {
|
||||||
|
selfTextPlain = selfTextPlain.substring(0, 250);
|
||||||
|
}
|
||||||
|
if (!selfText.equals("")) {
|
||||||
|
Pattern p = Pattern.compile(">!.+!<");
|
||||||
|
Matcher m = p.matcher(selfText.substring(0, Math.min(selfText.length(), 400)));
|
||||||
|
if (m.find()) {
|
||||||
|
post.setSelfTextPlainTrimmed("");
|
||||||
|
} else {
|
||||||
|
post.setSelfTextPlainTrimmed(selfTextPlain);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
post.setSelfTextPlainTrimmed(selfTextPlain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return post;
|
return post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,6 +320,16 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_gallery"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/bottom_constraint_layout_item_post_detail_gallery"
|
android:id="@+id/bottom_constraint_layout_item_post_detail_gallery"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -241,6 +241,16 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_image_and_gif_autoplay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -251,6 +251,16 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_link"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -254,6 +254,16 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_video_and_gif_preview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -235,6 +235,16 @@
|
|||||||
|
|
||||||
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_video_autoplay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -236,6 +236,16 @@
|
|||||||
|
|
||||||
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_item_post_detail_video_autoplay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user