aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-07-12 16:24:25 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-07-12 16:24:25 +0000
commit83eea69459eb56c964f25b5565766108d8fc25d6 (patch)
tree0c2529e1ef272860daaeca71bb27f0ccf7f8f895 /app
parentd17408e2c9f15b95c5d5839a1c9bb1aafddc4fd0 (diff)
downloadinfinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar.gz
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar.bz2
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar.lz
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar.xz
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.tar.zst
infinity-for-reddit-83eea69459eb56c964f25b5565766108d8fc25d6.zip
Only use SubsamplingScaleImageView to load images in ViewHolders for image in PostRecyclerViewAdapter and CommentAndPostRecyclerViewAdapter.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java136
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java305
-rw-r--r--app/src/main/res/layout/item_post_detail_gif_autoplay.xml8
-rw-r--r--app/src/main/res/layout/item_post_detail_image.xml1
-rw-r--r--app/src/main/res/layout/item_post_detail_link.xml6
-rw-r--r--app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml6
-rw-r--r--app/src/main/res/layout/item_post_detail_video_autoplay.xml6
-rw-r--r--app/src/main/res/layout/item_post_gif_autoplay.xml325
-rw-r--r--app/src/main/res/layout/item_post_image.xml (renamed from app/src/main/res/layout/item_post_image_and_gif_autoplay.xml)84
9 files changed, 637 insertions, 240 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index 45e3495e..ce1c32fa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -47,7 +47,6 @@ import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
-import com.github.piasy.biv.loader.ImageLoader;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.text.Cue;
@@ -59,7 +58,6 @@ import com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar;
import org.commonmark.ext.gfm.tables.TableBlock;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -103,7 +101,6 @@ import ml.docilealligator.infinityforreddit.BottomSheetFragment.ShareLinkBottomS
import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.Comment.FetchComment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.CustomView.AspectRatioBigImageView;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView;
import ml.docilealligator.infinityforreddit.CustomView.MarkwonLinearLayoutManager;
@@ -117,6 +114,7 @@ import ml.docilealligator.infinityforreddit.Utils.GlideImageGetter;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import ml.docilealligator.infinityforreddit.VoteThing;
+import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
@@ -713,17 +711,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (holder instanceof PostDetailVideoAutoplayViewHolder) {
((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) mPost.getPreviewWidth() / mPost.getPreviewHeight());
((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE);
- mGlide.asBitmap().load(mPost.getPreviewUrl()).into(new CustomTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
- ((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setImage(ImageSource.bitmap(resource));
- }
-
- @Override
- public void onLoadCleared(@Nullable Drawable placeholder) {
-
- }
- });
+ mGlide.load(mPost.getPreviewUrl()).into(((PostDetailVideoAutoplayViewHolder) holder).previewImageView);
((PostDetailVideoAutoplayViewHolder) holder).setVolume(mMuteAutoplayingVideos || (mPost.isNSFW() && mMuteNSFWVideo) ? 0f : 1f);
((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl()));
} else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
@@ -1235,49 +1223,26 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private void loadImage(PostDetailBaseViewHolder holder) {
if (holder instanceof PostDetailGifAutoplayViewHolder) {
- ((PostDetailGifAutoplayViewHolder) holder).mImageView.setImageLoaderCallback(new ImageLoader.Callback() {
- @Override
- public void onCacheHit(int imageType, File image) {
-
- }
-
- @Override
- public void onCacheMiss(int imageType, File image) {
-
- }
-
- @Override
- public void onStart() {
-
- }
-
- @Override
- public void onProgress(int progress) {
-
- }
-
- @Override
- public void onFinish() {
-
- }
-
- @Override
- public void onSuccess(File image) {
- ((PostDetailGifAutoplayViewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
- }
+ mGlide.asBitmap().load(mPost.getPreviewUrl())
+ .listener(new RequestListener<Bitmap>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE);
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE);
+ loadImage(holder);
+ });
+ return false;
+ }
- @Override
- public void onFail(Exception error) {
- ((PostDetailGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
- ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
- ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
- ((PostDetailGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE);
- ((PostDetailGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE);
- loadImage(holder);
- });
- }
- });
- ((PostDetailGifAutoplayViewHolder) holder).mImageView.showImage(Uri.parse(mPost.getUrl()));
+ @Override
+ public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ ((PostDetailGifAutoplayViewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
+ return false;
+ }
+ }).into(((PostDetailGifAutoplayViewHolder) holder).mImageView);
} else if (holder instanceof PostDetailImageViewHolder) {
RequestBuilder<Bitmap> imageRequestBuilder = mGlide.asBitmap().load(mPost.getPreviewUrl())
.listener(new RequestListener<Bitmap>() {
@@ -1318,10 +1283,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
imageRequestBuilder.apply(RequestOptions.noTransformation()).into(customTarget);
}
} else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
- RequestBuilder<Bitmap> imageRequestBuilder = mGlide.asBitmap().load(mPost.getPreviewUrl())
- .listener(new RequestListener<Bitmap>() {
+ RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(mPost.getPreviewUrl())
+ .listener(new RequestListener<Drawable>() {
@Override
- public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
@@ -1333,35 +1298,23 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
@Override
- public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
((PostDetailVideoAndGifPreviewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
return false;
}
});
- CustomTarget<Bitmap> customTarget = new CustomTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
- ((PostDetailVideoAndGifPreviewHolder) holder).mImageView.setImage(ImageSource.bitmap(resource));
- }
-
- @Override
- public void onLoadCleared(@Nullable Drawable placeholder) {
-
- }
- };
-
if ((mPost.isNSFW() && mNeedBlurNsfw) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
- .into(customTarget);
+ .into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
} else {
- imageRequestBuilder.apply(RequestOptions.noTransformation()).into(customTarget);
+ imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
}
} else if (holder instanceof PostDetailLinkViewHolder) {
- RequestBuilder<Bitmap> imageRequestBuilder = mGlide.asBitmap().load(mPost.getPreviewUrl())
- .listener(new RequestListener<Bitmap>() {
+ RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(mPost.getPreviewUrl())
+ .listener(new RequestListener<Drawable>() {
@Override
- public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
((PostDetailLinkViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
@@ -1373,28 +1326,17 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
@Override
- public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
((PostDetailLinkViewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
return false;
}
});
- CustomTarget<Bitmap> customTarget = new CustomTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
- ((PostDetailLinkViewHolder) holder).mImageView.setImage(ImageSource.bitmap(resource));
- }
-
- @Override
- public void onLoadCleared(@Nullable Drawable placeholder) {
-
- }
- };
-
if ((mPost.isNSFW() && mNeedBlurNsfw) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
- imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(customTarget);
+ imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
+ .into(((PostDetailLinkViewHolder) holder).mImageView);
} else {
- imageRequestBuilder.into(customTarget);
+ imageRequestBuilder.into(((PostDetailLinkViewHolder) holder).mImageView);
}
}
}
@@ -1961,6 +1903,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE);
} else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
mGlide.clear(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
+ } else if (holder instanceof PostDetailGifAutoplayViewHolder) {
+ mGlide.clear(((PostDetailGifAutoplayViewHolder) holder).mImageView);
} else if (holder instanceof PostDetailImageViewHolder) {
mGlide.clear(((PostDetailImageViewHolder) holder).mImageView);
} else if (holder instanceof PostDetailLinkViewHolder) {
@@ -2459,7 +2403,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.player_view_item_post_detail_video_autoplay)
PlayerView playerView;
@BindView(R.id.preview_image_view_item_post_detail_video_autoplay)
- SubsamplingScaleImageView previewImageView;
+ GifImageView previewImageView;
@BindView(R.id.mute_exo_playback_control_view)
ImageView muteButton;
@BindView(R.id.fullscreen_exo_playback_control_view)
@@ -2678,7 +2622,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.load_image_error_text_view_item_post_detail_video_and_gif_preview)
TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_item_post_detail_video_and_gif_preview)
- AspectRatioSubsamplingScaleImageView mImageView;
+ AspectRatioGifImageView mImageView;
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview)
ConstraintLayout mBottomConstraintLayout;
@BindView(R.id.plus_button_item_post_detail_video_and_gif_preview)
@@ -2782,7 +2726,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.load_image_error_text_view_item_post_detail_gif_autoplay)
TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_item_post_detail_gif_autoplay)
- AspectRatioBigImageView mImageView;
+ AspectRatioGifImageView mImageView;
@BindView(R.id.bottom_constraint_layout_item_post_detail_gif_autoplay)
ConstraintLayout mBottomConstraintLayout;
@BindView(R.id.plus_button_item_post_detail_gif_autoplay)
@@ -2988,7 +2932,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.load_image_error_text_view_item_post_detail_link)
TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_item_post_detail_link)
- AspectRatioSubsamplingScaleImageView mImageView;
+ AspectRatioGifImageView mImageView;
@BindView(R.id.bottom_constraint_layout_item_post_detail_link)
ConstraintLayout mBottomConstraintLayout;
@BindView(R.id.plus_button_item_post_detail_link)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 5f2c2605..c500366f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Bitmap;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -39,7 +40,11 @@ import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
+import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
+import com.bumptech.glide.request.transition.Transition;
+import com.davemorrissey.labs.subscaleview.ImageSource;
+import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.text.Cue;
@@ -78,6 +83,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.ShareLinkBottomSheetFragment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
+import ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView;
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity;
import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.Post.Post;
@@ -98,15 +104,16 @@ import retrofit2.Retrofit;
*/
public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHolder> implements CacheManager {
- private static final int VIEW_TYPE_POST_CARD_VIDEO_TYPE_AUTOPLAY = 1;
+ private static final int VIEW_TYPE_POST_CARD_VIDEO_AUTOPLAY_TYPE = 1;
private static final int VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE = 2;
- private static final int VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE = 3;
- private static final int VIEW_TYPE_POST_CARD_LINK_TYPE = 4;
- private static final int VIEW_TYPE_POST_CARD_NO_PREVIEW_LINK_TYPE = 5;
- private static final int VIEW_TYPE_POST_CARD_TEXT_TYPE = 6;
- private static final int VIEW_TYPE_POST_COMPACT = 7;
- private static final int VIEW_TYPE_ERROR = 8;
- private static final int VIEW_TYPE_LOADING = 9;
+ private static final int VIEW_TYPE_POST_CARD_GIF_AUTOPLAY_TYPE = 3;
+ private static final int VIEW_TYPE_POST_CARD_IMAGE_TYPE = 4;
+ private static final int VIEW_TYPE_POST_CARD_LINK_TYPE = 5;
+ private static final int VIEW_TYPE_POST_CARD_NO_PREVIEW_LINK_TYPE = 6;
+ private static final int VIEW_TYPE_POST_CARD_TEXT_TYPE = 7;
+ private static final int VIEW_TYPE_POST_COMPACT = 8;
+ private static final int VIEW_TYPE_ERROR = 9;
+ private static final int VIEW_TYPE_LOADING = 10;
private static final DiffUtil.ItemCallback<Post> DIFF_CALLBACK = new DiffUtil.ItemCallback<Post>() {
@Override
public boolean areItemsTheSame(@NonNull Post post, @NonNull Post t1) {
@@ -291,7 +298,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (!mAutoplayNsfwVideos && post.isNSFW()) {
return VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE;
}
- return VIEW_TYPE_POST_CARD_VIDEO_TYPE_AUTOPLAY;
+ return VIEW_TYPE_POST_CARD_VIDEO_AUTOPLAY_TYPE;
}
return VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE;
case Post.GIF_TYPE:
@@ -299,11 +306,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (!mAutoplayNsfwVideos && post.isNSFW()) {
return VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE;
}
- return VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE;
+ return VIEW_TYPE_POST_CARD_GIF_AUTOPLAY_TYPE;
}
return VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE;
case Post.IMAGE_TYPE:
- return VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE;
+ return VIEW_TYPE_POST_CARD_IMAGE_TYPE;
case Post.LINK_TYPE:
return VIEW_TYPE_POST_CARD_LINK_TYPE;
case Post.NO_PREVIEW_LINK_TYPE:
@@ -322,12 +329,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- if (viewType == VIEW_TYPE_POST_CARD_VIDEO_TYPE_AUTOPLAY) {
+ if (viewType == VIEW_TYPE_POST_CARD_VIDEO_AUTOPLAY_TYPE) {
return new PostVideoAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_video_type_autoplay, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE) {
return new PostVideoAndGifPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_video_and_gif_preview, parent, false));
- } else if (viewType == VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE) {
- return new PostImageAndGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_image_and_gif_autoplay, parent, false));
+ } else if (viewType == VIEW_TYPE_POST_CARD_GIF_AUTOPLAY_TYPE) {
+ return new PostGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_gif_autoplay, parent, false));
+ } else if (viewType == VIEW_TYPE_POST_CARD_IMAGE_TYPE) {
+ return new PostImageViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_image, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_LINK_TYPE) {
return new PostLinkTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_link, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_NO_PREVIEW_LINK_TYPE) {
@@ -559,20 +568,20 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostVideoAndGifPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
((PostVideoAndGifPreviewViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
}
- } else if (holder instanceof PostImageAndGifAutoplayViewHolder) {
- if (post.getPostType() == Post.GIF_TYPE) {
- ((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
- } else {
- ((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.image));
- }
- ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayViewHolder) holder).imageView
+ } else if (holder instanceof PostGifAutoplayViewHolder) {
+ ((PostGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostGifAutoplayViewHolder) holder).imageView
+ .setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
+ loadImage(holder, post);
+ } else if (holder instanceof PostImageViewHolder) {
+ ((PostImageViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostImageViewHolder) holder).imageView
.setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
loadImage(holder, post);
if (post.getPreviewWidth() <= 0 || post.getPreviewHeight() <= 0) {
- ((PostImageAndGifAutoplayViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostImageAndGifAutoplayViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
+ ((PostImageViewHolder) holder).imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
+ ((PostImageViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
}
} else if (holder instanceof PostLinkTypeViewHolder) {
((PostLinkTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
@@ -843,16 +852,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
private void loadImage(final RecyclerView.ViewHolder holder, final Post post) {
- if (holder instanceof PostImageAndGifAutoplayViewHolder) {
- String url = mAutoplay && post.getPostType() == Post.GIF_TYPE ? post.getUrl() : post.getPreviewUrl();
- RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url).listener(new RequestListener<Drawable>() {
+ if (holder instanceof PostGifAutoplayViewHolder) {
+ mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
- ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
- ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
- ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
+ ((PostGifAutoplayViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
+ ((PostGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
loadImage(holder, post);
});
return false;
@@ -860,17 +868,49 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
- ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
- ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
+ return false;
+ }
+ }).into(((PostGifAutoplayViewHolder) holder).imageView);
+ } else if (holder instanceof PostImageViewHolder) {
+ RequestBuilder<Bitmap> imageRequestBuilder = mGlide.asBitmap().load(post.getPreviewUrl()).listener(new RequestListener<Bitmap>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
+ ((PostImageViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostImageViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
+ ((PostImageViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
+ ((PostImageViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostImageViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ loadImage(holder, post);
+ });
+ return false;
+ }
+
+ @Override
+ public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ ((PostImageViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostImageViewHolder) holder).progressBar.setVisibility(View.GONE);
return false;
}
});
+ CustomTarget<Bitmap> customTarget = new CustomTarget<Bitmap>() {
+ @Override
+ public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
+ ((PostImageViewHolder) holder).imageView.setImage(ImageSource.cachedBitmap(resource));
+ }
+
+ @Override
+ public void onLoadCleared(@Nullable Drawable placeholder) {
+
+ }
+ };
+
if ((post.isNSFW() && mNeedBlurNSFW) || post.isSpoiler() && mNeedBlurSpoiler) {
- imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
- .into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
+ imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(customTarget);
} else {
- imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
+ imageRequestBuilder.apply(RequestOptions.noTransformation()).into(customTarget);
}
} else if (holder instanceof PostVideoAndGifPreviewViewHolder) {
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
@@ -1079,14 +1119,19 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostVideoAutoplayViewHolder) holder).resetVolume();
mGlide.clear(((PostVideoAutoplayViewHolder) holder).previewImageView);
((PostVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE);
- } else if (holder instanceof PostImageAndGifAutoplayViewHolder) {
- mGlide.clear(((PostImageAndGifAutoplayViewHolder) holder).imageView);
- ((PostImageAndGifAutoplayViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.FIT_START);
- ((PostImageAndGifAutoplayViewHolder) holder).imageView.getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
- ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ } else if (holder instanceof PostGifAutoplayViewHolder) {
+ mGlide.clear(((PostGifAutoplayViewHolder) holder).imageView);
+ ((PostGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ } else if (holder instanceof PostImageViewHolder) {
+ mGlide.clear(((PostImageViewHolder) holder).imageView);
+ ((PostImageViewHolder) holder).imageView.recycle();
+ ((PostImageViewHolder) holder).imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_START);
+ ((PostImageViewHolder) holder).imageView.getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
+ ((PostImageViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ } else if (holder instanceof PostVideoAndGifPreviewViewHolder) {
+ mGlide.clear(((PostVideoAndGifPreviewViewHolder) holder).imageView);
} else if (holder instanceof PostLinkTypeViewHolder) {
mGlide.clear(((PostLinkTypeViewHolder) holder).imageView);
- ((PostLinkTypeViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.FIT_START);
((PostLinkTypeViewHolder) holder).imageView.getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
((PostLinkTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
} else if (holder instanceof PostTextTypeViewHolder) {
@@ -1910,61 +1955,61 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- class PostImageAndGifAutoplayViewHolder extends PostBaseViewHolder {
- @BindView(R.id.card_view_item_post_image_and_gif_autoplay)
+ class PostGifAutoplayViewHolder extends PostBaseViewHolder {
+ @BindView(R.id.card_view_item_post_gif_autoplay)
MaterialCardView cardView;
- @BindView(R.id.icon_gif_image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.icon_gif_image_view_item_post_gif_autoplay)
AspectRatioGifImageView iconGifImageView;
- @BindView(R.id.subreddit_name_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.subreddit_name_text_view_item_post_gif_autoplay)
TextView subredditTextView;
- @BindView(R.id.user_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.user_text_view_item_post_gif_autoplay)
TextView userTextView;
- @BindView(R.id.stickied_post_image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.stickied_post_image_view_item_post_gif_autoplay)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.post_time_text_view_item_post_gif_autoplay)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.title_text_view_item_post_gif_autoplay)
TextView titleTextView;
- @BindView(R.id.type_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.type_text_view_item_post_gif_autoplay)
CustomTextView typeTextView;
- @BindView(R.id.archived_image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.archived_image_view_item_post_gif_autoplay)
ImageView archivedImageView;
- @BindView(R.id.locked_image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.locked_image_view_item_post_gif_autoplay)
ImageView lockedImageView;
- @BindView(R.id.crosspost_image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.crosspost_image_view_item_post_gif_autoplay)
ImageView crosspostImageView;
- @BindView(R.id.nsfw_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.nsfw_text_view_item_post_gif_autoplay)
CustomTextView nsfwTextView;
- @BindView(R.id.spoiler_custom_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.spoiler_custom_text_view_item_post_gif_autoplay)
CustomTextView spoilerTextView;
- @BindView(R.id.flair_custom_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.flair_custom_text_view_item_post_gif_autoplay)
CustomTextView flairTextView;
- @BindView(R.id.awards_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.awards_text_view_item_post_gif_autoplay)
CustomTextView awardsTextView;
- @BindView(R.id.progress_bar_item_post_image_and_gif_autoplay)
+ @BindView(R.id.progress_bar_item_post_gif_autoplay)
ProgressBar progressBar;
- @BindView(R.id.image_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.image_view_item_post_gif_autoplay)
AspectRatioGifImageView imageView;
- @BindView(R.id.load_image_error_relative_layout_item_post_image_and_gif_autoplay)
+ @BindView(R.id.load_image_error_relative_layout_item_post_gif_autoplay)
RelativeLayout errorRelativeLayout;
- @BindView(R.id.load_image_error_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.load_image_error_text_view_item_post_gif_autoplay)
TextView errorTextView;
- @BindView(R.id.bottom_constraint_layout_item_post_image_and_gif_autoplay)
+ @BindView(R.id.bottom_constraint_layout_item_post_gif_autoplay)
ConstraintLayout bottomConstraintLayout;
- @BindView(R.id.plus_button_item_post_image_and_gif_autoplay)
+ @BindView(R.id.plus_button_item_post_gif_autoplay)
ImageView upvoteButton;
- @BindView(R.id.score_text_view_item_post_image_and_gif_autoplay)
+ @BindView(R.id.score_text_view_item_post_gif_autoplay)
TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_image_and_gif_autoplay)
+ @BindView(R.id.minus_button_item_post_gif_autoplay)
ImageView downvoteButton;
- @BindView(R.id.comments_count_item_post_image_and_gif_autoplay)
+ @BindView(R.id.comments_count_item_post_gif_autoplay)
TextView commentsCountTextView;
- @BindView(R.id.save_button_item_post_image_and_gif_autoplay)
+ @BindView(R.id.save_button_item_post_gif_autoplay)
ImageView saveButton;
- @BindView(R.id.share_button_item_post_image_and_gif_autoplay)
+ @BindView(R.id.share_button_item_post_gif_autoplay)
ImageView shareButton;
- PostImageAndGifAutoplayViewHolder(View itemView) {
+ PostGifAutoplayViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
setBaseView(cardView,
@@ -1996,21 +2041,109 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
imageView.setOnClickListener(view -> {
Post post = getItem(getAdapterPosition());
if (post != null) {
- if (post.getPostType() == Post.IMAGE_TYPE) {
- Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class);
- intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, post.getUrl());
- intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName()
- + "-" + post.getId() + ".jpg");
- intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle());
- mActivity.startActivity(intent);
- } else if (post.getPostType() == Post.GIF_TYPE) {
- Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class);
- intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName()
- + "-" + post.getId() + ".gif");
- intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, post.getVideoUrl());
- intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle());
- mActivity.startActivity(intent);
- }
+ Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class);
+ intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName()
+ + "-" + post.getId() + ".gif");
+ intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, post.getVideoUrl());
+ intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle());
+ mActivity.startActivity(intent);
+ }
+ });
+ }
+ }
+
+ class PostImageViewHolder extends PostBaseViewHolder {
+ @BindView(R.id.card_view_item_post_image)
+ MaterialCardView cardView;
+ @BindView(R.id.icon_gif_image_view_item_post_image)
+ AspectRatioGifImageView iconGifImageView;
+ @BindView(R.id.subreddit_name_text_view_item_post_image)
+ TextView subredditTextView;
+ @BindView(R.id.user_text_view_item_post_image)
+ TextView userTextView;
+ @BindView(R.id.stickied_post_image_view_item_post_image)
+ ImageView stickiedPostImageView;
+ @BindView(R.id.post_time_text_view_item_post_image)
+ TextView postTimeTextView;
+ @BindView(R.id.title_text_view_item_post_image)
+ TextView titleTextView;
+ @BindView(R.id.type_text_view_item_post_image)
+ CustomTextView typeTextView;
+ @BindView(R.id.archived_image_view_item_post_image)
+ ImageView archivedImageView;
+ @BindView(R.id.locked_image_view_item_post_image)
+ ImageView lockedImageView;
+ @BindView(R.id.crosspost_image_view_item_post_image)
+ ImageView crosspostImageView;
+ @BindView(R.id.nsfw_text_view_item_post_image)
+ CustomTextView nsfwTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_image)
+ CustomTextView spoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_image)
+ CustomTextView flairTextView;
+ @BindView(R.id.awards_text_view_item_post_image)
+ CustomTextView awardsTextView;
+ @BindView(R.id.progress_bar_item_post_image)
+ ProgressBar progressBar;
+ @BindView(R.id.image_view_item_post_image)
+ AspectRatioSubsamplingScaleImageView imageView;
+ @BindView(R.id.load_image_error_relative_layout_item_post_image)
+ RelativeLayout errorRelativeLayout;
+ @BindView(R.id.load_image_error_text_view_item_post_image)
+ TextView errorTextView;
+ @BindView(R.id.bottom_constraint_layout_item_post_image)
+ ConstraintLayout bottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_image)
+ ImageView upvoteButton;
+ @BindView(R.id.score_text_view_item_post_image)
+ TextView scoreTextView;
+ @BindView(R.id.minus_button_item_post_image)
+ ImageView downvoteButton;
+ @BindView(R.id.comments_count_item_post_image)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_image)
+ ImageView saveButton;
+ @BindView(R.id.share_button_item_post_image)
+ ImageView shareButton;
+
+ PostImageViewHolder(View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(cardView,
+ iconGifImageView,
+ subredditTextView,
+ userTextView,
+ stickiedPostImageView,
+ postTimeTextView,
+ titleTextView,
+ typeTextView,
+ archivedImageView,
+ lockedImageView,
+ crosspostImageView,
+ nsfwTextView,
+ spoilerTextView,
+ flairTextView,
+ awardsTextView,
+ bottomConstraintLayout,
+ upvoteButton,
+ scoreTextView,
+ downvoteButton,
+ commentsCountTextView,
+ saveButton,
+ shareButton);
+
+ progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ errorTextView.setTextColor(mPrimaryTextColor);
+
+ imageView.setOnClickListener(view -> {
+ Post post = getItem(getAdapterPosition());
+ if (post != null) {
+ Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class);
+ intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, post.getUrl());
+ intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName()
+ + "-" + post.getId() + ".jpg");
+ intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle());
+ mActivity.startActivity(intent);
}
});
}
diff --git a/app/src/main/res/layout/item_post_detail_gif_autoplay.xml b/app/src/main/res/layout/item_post_detail_gif_autoplay.xml
index f81fffd6..9a86fc1a 100644
--- a/app/src/main/res/layout/item_post_detail_gif_autoplay.xml
+++ b/app/src/main/res/layout/item_post_detail_gif_autoplay.xml
@@ -200,16 +200,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioBigImageView
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/image_view_item_post_detail_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
- android:scaleType="fitStart"
- app:optimizeDisplay="true"
- app:tapToRetry="false"
- app:zoomEnabled="false"
- app:panEnabled="false" />
+ android:scaleType="fitStart" />
<RelativeLayout
android:id="@+id/load_wrapper_item_post_detail_gif_autoplay"
diff --git a/app/src/main/res/layout/item_post_detail_image.xml b/app/src/main/res/layout/item_post_detail_image.xml
index b31ee7b4..0c0ed5f5 100644
--- a/app/src/main/res/layout/item_post_detail_image.xml
+++ b/app/src/main/res/layout/item_post_detail_image.xml
@@ -206,6 +206,7 @@
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
+ app:quickScaleEnabled="false"
app:zoomEnabled="false"
app:panEnabled="false" />
diff --git a/app/src/main/res/layout/item_post_detail_link.xml b/app/src/main/res/layout/item_post_detail_link.xml
index ba51e6a5..a0868b07 100644
--- a/app/src/main/res/layout/item_post_detail_link.xml
+++ b/app/src/main/res/layout/item_post_detail_link.xml
@@ -210,14 +210,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/image_view_item_post_detail_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
- android:scaleType="fitStart"
- app:zoomEnabled="false"
- app:panEnabled="false" />
+ android:scaleType="fitStart" />
<RelativeLayout
android:id="@+id/load_wrapper_item_post_detail_link"
diff --git a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml
index a25c25a2..83fb172a 100644
--- a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml
+++ b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml
@@ -202,14 +202,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/image_view_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
- android:scaleType="fitStart"
- app:zoomEnabled="false"
- app:panEnabled="false" />
+ android:scaleType="fitStart" />
<ImageView
android:layout_width="wrap_content"
diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay.xml b/app/src/main/res/layout/item_post_detail_video_autoplay.xml
index 3a41f4d3..9d8e8590 100644
--- a/app/src/main/res/layout/item_post_detail_video_autoplay.xml
+++ b/app/src/main/res/layout/item_post_detail_video_autoplay.xml
@@ -208,14 +208,12 @@
android:layout_height="match_parent"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view"/>
- <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
+ <pl.droidsonroids.gif.GifImageView
android:id="@+id/preview_image_view_item_post_detail_video_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitStart"
- android:visibility="gone"
- app:zoomEnabled="false"
- app:panEnabled="false" />
+ android:visibility="gone" />
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
diff --git a/app/src/main/res/layout/item_post_gif_autoplay.xml b/app/src/main/res/layout/item_post_gif_autoplay.xml
new file mode 100644
index 00000000..504cb903
--- /dev/null
+++ b/app/src/main/res/layout/item_post_gif_autoplay.xml
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"
+ android:id="@+id/card_view_item_post_gif_autoplay"
+ app:cardBackgroundColor="?attr/cardViewBackgroundColor"
+ app:cardElevation="2dp"
+ app:cardCornerRadius="16dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/subreddit_name_text_view_item_post_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_gif_autoplay"
+ app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_autoplay"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_autoplay"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_gif_autoplay"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <ImageView
+ android:id="@+id/stickied_post_image_view_item_post_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_marginEnd="8dp"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@+id/guideline2"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline2"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textSize="?attr/title_font_18"
+ android:fontFamily="?attr/title_font_family" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/gif"
+ android:textSize="?attr/font_12"
+ android:fontFamily="?attr/font_family"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:fontFamily="?attr/font_family"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:fontFamily="?attr/font_family"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textSize="?attr/font_12"
+ android:fontFamily="?attr/font_family"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/awards_text_view_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:fontFamily="?attr/font_family"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/image_view_item_post_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:scaleType="fitStart" />
+
+ <ProgressBar
+ android:id="@+id/progress_bar_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true" />
+
+ <RelativeLayout
+ android:id="@+id/load_image_error_relative_layout_item_post_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_centerInParent="true"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/load_image_error_text_view_item_post_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:drawableTop="@drawable/ic_error_outline_black_24dp"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/error_loading_image_tap_to_retry"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ </RelativeLayout>
+
+ </RelativeLayout>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/bottom_constraint_layout_item_post_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_gif_autoplay"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_gif_autoplay" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:gravity="center_vertical"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ android:fontFamily="?attr/font_family"
+ android:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_share_grey_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ </LinearLayout>
+
+</com.google.android.material.card.MaterialCardView> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_image.xml
index 39bf4933..2a1f8513 100644
--- a/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml
+++ b/app/src/main/res/layout/item_post_image.xml
@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
- android:id="@+id/card_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/card_view_item_post_image"
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
app:cardElevation="2dp"
app:cardCornerRadius="16dp">
@@ -21,7 +21,7 @@
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/icon_gif_image_view_item_post_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
@@ -30,7 +30,7 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/subreddit_name_text_view_item_post_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -38,13 +38,13 @@
android:layout_marginEnd="8dp"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
- app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image_and_gif_autoplay"
- app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image_and_gif_autoplay"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image"
+ app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/user_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/user_text_view_item_post_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -54,24 +54,24 @@
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_image_and_gif_autoplay"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_and_gif_autoplay"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_image"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_image"
app:layout_constraintHorizontal_bias="0" />
<ImageView
- android:id="@+id/stickied_post_image_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/stickied_post_image_view_item_post_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/post_time_text_view_item_post_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -92,7 +92,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/title_text_view_item_post_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -109,10 +109,11 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/type_text_view_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
+ android:text="@string/image"
android:textSize="?attr/font_12"
android:fontFamily="?attr/font_family"
app:lib_setRadius="3dp"
@@ -120,7 +121,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/spoiler_custom_text_view_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -134,7 +135,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/nsfw_text_view_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -147,7 +148,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/flair_custom_text_view_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -160,7 +161,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/awards_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/awards_text_view_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -172,21 +173,21 @@
app:lib_setShape="rectangle" />
<ImageView
- android:id="@+id/archived_image_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/archived_image_view_item_post_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_archive_outline"
android:visibility="gone" />
<ImageView
- android:id="@+id/locked_image_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/locked_image_view_item_post_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_outline_lock_24dp"
android:visibility="gone" />
<ImageView
- android:id="@+id/crosspost_image_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/crosspost_image_view_item_post_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
@@ -198,28 +199,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/image_view_item_post_image_and_gif_autoplay"
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView
+ android:id="@+id/image_view_item_post_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
- android:scaleType="fitStart" />
+ android:scaleType="fitStart"
+ app:quickScaleEnabled="false"
+ app:zoomEnabled="false"
+ app:panEnabled="false" />
<ProgressBar
- android:id="@+id/progress_bar_item_post_image_and_gif_autoplay"
+ android:id="@+id/progress_bar_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<RelativeLayout
- android:id="@+id/load_image_error_relative_layout_item_post_image_and_gif_autoplay"
+ android:id="@+id/load_image_error_relative_layout_item_post_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone">
<TextView
- android:id="@+id/load_image_error_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/load_image_error_text_view_item_post_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@@ -234,12 +238,12 @@
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/bottom_constraint_layout_item_post_image_and_gif_autoplay"
+ android:id="@+id/bottom_constraint_layout_item_post_image"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
- android:id="@+id/plus_button_item_post_image_and_gif_autoplay"
+ android:id="@+id/plus_button_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -252,7 +256,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
- android:id="@+id/score_text_view_item_post_image_and_gif_autoplay"
+ android:id="@+id/score_text_view_item_post_image"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@@ -261,10 +265,10 @@
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_and_gif_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image" />
<ImageView
- android:id="@+id/minus_button_item_post_image_and_gif_autoplay"
+ android:id="@+id/minus_button_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -274,10 +278,10 @@
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image_and_gif_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image" />
<TextView
- android:id="@+id/comments_count_item_post_image_and_gif_autoplay"
+ android:id="@+id/comments_count_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -289,10 +293,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image_and_gif_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image" />
<ImageView
- android:id="@+id/save_button_item_post_image_and_gif_autoplay"
+ android:id="@+id/save_button_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -302,11 +306,11 @@
app:layout_constraintHorizontal_bias="1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post_image_and_gif_autoplay"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image_and_gif_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_image"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image" />
<ImageView
- android:id="@+id/share_button_item_post_image_and_gif_autoplay"
+ android:id="@+id/share_button_item_post_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"