diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-11-18 16:18:26 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-11-18 16:18:26 +0000 |
commit | 91a979049d7e71a3fd2dd3c1fc46b4967dbaa444 (patch) | |
tree | 1dc7db66c827dd3f6cf9cf86000788e6265a766a | |
parent | ccde986d8416da316b1638916eb122eb798bbe57 (diff) | |
download | infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar.gz infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar.bz2 infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar.lz infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar.xz infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.tar.zst infinity-for-reddit-91a979049d7e71a3fd2dd3c1fc46b4967dbaa444.zip |
Fix link icon not shown in no preview ImageView.
Diffstat (limited to '')
4 files changed, 19 insertions, 10 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 0d992340..9a6f765a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -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() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java index ed9c50df..42c6b706 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java @@ -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); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index cf53ffb4..52e25fe5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -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) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ecc9b8a5..fa386470 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -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> |