diff options
Diffstat (limited to 'app/src/main')
2 files changed, 16 insertions, 18 deletions
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<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); 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<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); |