From 31a7c2be3ad39cdeba88515cb7343810f84db249 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 7 Aug 2021 12:06:07 +0800 Subject: Version 5.0.0-beta4. Revert changes that limit the max height of images in PostRecyclerViewAdapter and PostDetailRecyclerViewAdapter. --- app/build.gradle | 4 +-- .../adapters/PostDetailRecyclerViewAdapter.java | 5 ++-- .../adapters/PostRecyclerViewAdapter.java | 29 +++++++++++----------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ab30705f..907a6801 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "ml.docilealligator.infinityforreddit" minSdkVersion 21 targetSdkVersion 30 - versionCode 73 - versionName "5.0.0-beta3" + versionCode 74 + versionName "5.0.0-beta4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { annotationProcessorOptions { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 98a74bb0..2fa784eb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -126,7 +126,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); 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 184b3991..9d08d880 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -116,7 +116,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter DIFF_CALLBACK = new DiffUtil.ItemCallback() { @Override @@ -811,8 +810,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostWithPreviewTypeViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostWithPreviewTypeViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -945,8 +944,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostCard2WithPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostCard2WithPreviewViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -1340,8 +1339,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostGalleryViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -1375,8 +1374,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostGalleryViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -1400,8 +1399,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostGalleryViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -1425,8 +1424,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostGalleryViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); @@ -1460,8 +1459,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter MAX_IMAGE_HEIGHT) { - int height = preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 ? (int) (400 * mScale) : (int) (MAX_IMAGE_HEIGHT * mScale); + if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { + int height = (int) (400 * mScale); ((PostGalleryViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostGalleryViewHolder) holder).imageView.getLayoutParams().height = height; preview.setPreviewWidth(mImageViewWidth); -- cgit v1.2.3