diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-13 07:41:48 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-13 07:41:48 +0000 |
commit | c44fecb3f2504a228234751db380d98af32339ee (patch) | |
tree | 8eb650e3b68db4bc247c8750f340750fdceca814 /app/src/main/java | |
parent | ef1b14cc6ae1ddf03e2e410e9df69d0aad4160ab (diff) | |
download | infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar.gz infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar.bz2 infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar.lz infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar.xz infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.tar.zst infinity-for-reddit-c44fecb3f2504a228234751db380d98af32339ee.zip |
Fix gallery layout issues.
Diffstat (limited to 'app/src/main/java')
2 files changed, 36 insertions, 36 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index b14d094c..7653ecbf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -1318,12 +1318,12 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy switch (post.getPostType()) { case Post.IMAGE_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1391,14 +1391,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy break; } case Post.VIDEO_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1421,14 +1421,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy break; } case Post.LINK_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1461,14 +1461,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy break; } case Post.GALLERY_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 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 aec73069..c6baefb1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -1400,12 +1400,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie switch (post.getPostType()) { case Post.IMAGE_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1473,14 +1473,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie break; } case Post.VIDEO_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1503,14 +1503,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie break; } case Post.LINK_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); @@ -1543,14 +1543,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie break; } case Post.GALLERY_TYPE: { - ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); - ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp)); - Post.Preview preview = getSuitablePreview(post.getPreviews()); ((PostGalleryViewHolder) holder).preview = preview; if (preview != null) { + ((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE); + ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp)); + if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) { int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); |