mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Fix link icon not shown in no preview ImageView.
This commit is contained in:
parent
ccde986d84
commit
91a979049d
@ -401,8 +401,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
|
||||
@Override
|
||||
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||
if (!(viewHolder instanceof CommentAndPostRecyclerViewAdapter.PostDetailBaseViewHolder) &&
|
||||
!(viewHolder instanceof CommentAndPostRecyclerViewAdapter.CommentViewHolder)) {
|
||||
if (!(viewHolder instanceof CommentAndPostRecyclerViewAdapter.CommentViewHolder)) {
|
||||
return makeMovementFlags(0, 0);
|
||||
}
|
||||
int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
|
||||
@ -1839,9 +1838,6 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
if (mSlidrInterface != null) {
|
||||
mSlidrInterface.lock();
|
||||
}
|
||||
if (touchHelper != null) {
|
||||
touchHelper.attachToRecyclerView(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void unlockSwipeRightToGoBack() {
|
||||
|
@ -923,9 +923,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
|
||||
} else if (holder instanceof PostDetailNoPreviewViewHolder) {
|
||||
if (mPost.getPostType() == Post.LINK_TYPE || mPost.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
||||
((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.link);
|
||||
String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost();
|
||||
((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setVisibility(View.VISIBLE);
|
||||
((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setText(noPreviewLinkDomain);
|
||||
((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_link);
|
||||
} else {
|
||||
((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setVisibility(View.GONE);
|
||||
switch (mPost.getPostType()) {
|
||||
@ -941,10 +943,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.gif);
|
||||
((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_image_24dp);
|
||||
break;
|
||||
case Post.LINK_TYPE:
|
||||
case Post.NO_PREVIEW_LINK_TYPE:
|
||||
((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.link);
|
||||
break;
|
||||
case Post.GALLERY_TYPE:
|
||||
((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.gallery);
|
||||
((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_gallery_24dp);
|
||||
|
@ -630,6 +630,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
((PostWithPreviewTypeViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
|
||||
String domain = Uri.parse(post.getUrl()).getHost();
|
||||
((PostWithPreviewTypeViewHolder) holder).linkTextView.setText(domain);
|
||||
if (post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE);
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_link);
|
||||
}
|
||||
} else if (post.getPostType() == Post.GALLERY_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gallery));
|
||||
}
|
||||
@ -665,6 +669,17 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
loadImage(holder, post, preview);
|
||||
} else {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE);
|
||||
if (post.getPostType() == Post.VIDEO_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_outline_video_24dp);
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.GONE);
|
||||
} else if (post.getPostType() == Post.IMAGE_TYPE || post.getPostType() == Post.GIF_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_image_24dp);
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.GONE);
|
||||
} else if (post.getPostType() == Post.LINK_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_link);
|
||||
} else if (post.getPostType() == Post.GALLERY_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_gallery_24dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof PostTextTypeViewHolder) {
|
||||
|
@ -506,7 +506,7 @@
|
||||
<string name="settings_disable_image_preview_title">Disable Image Preview in Data Saving Mode</string>
|
||||
<string name="settings_swipe_action_swipe_left_title">Swipe Left</string>
|
||||
<string name="settings_swipe_action_swipe_right_title">Swipe Right</string>
|
||||
<string name="settings_swipe_action_info_summary">Not applicable to post feed with more than 1 column.</string>
|
||||
<string name="settings_swipe_action_info_summary">Not applicable to post feed with more than 1 column or post detail.</string>
|
||||
|
||||
<string name="no_link_available">Cannot get the link</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user