Version 5.0.0-beta4. Revert changes that limit the max height of images in PostRecyclerViewAdapter and PostDetailRecyclerViewAdapter.

This commit is contained in:
Alex Ning 2021-08-07 12:06:07 +08:00
parent 7b6f9339e7
commit 31a7c2be3a
3 changed files with 18 additions and 20 deletions

View File

@ -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 {

View File

@ -126,7 +126,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private static final int VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK = 6;
private static final int VIEW_TYPE_POST_DETAIL_GALLERY = 7;
private static final int VIEW_TYPE_POST_DETAIL_TEXT_TYPE = 8;
private static final int MAX_IMAGE_HEIGHT = 2000;
private AppCompatActivity mActivity;
private ViewPostDetailFragment mFragment;
@ -721,8 +720,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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);

View File

@ -116,7 +116,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private static final int VIEW_TYPE_POST_CARD_2_TEXT_TYPE = 8;
private static final int VIEW_TYPE_ERROR = 9;
private static final int VIEW_TYPE_LOADING = 10;
private static final int MAX_IMAGE_HEIGHT = 2000;
private static final DiffUtil.ItemCallback<Post> DIFF_CALLBACK = new DiffUtil.ItemCallback<Post>() {
@Override
@ -811,8 +810,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
((PostWithPreviewTypeViewHolder) holder).imageWrapperRelativeLayout.setVisibility(View.VISIBLE);
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
((PostCard2WithPreviewViewHolder) holder).imageView.setVisibility(View.VISIBLE);
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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<Post, RecyclerView
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0 || preview.getPreviewHeight() > 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);