Probably fix app crashes when loading large images in PostRecyclerViewAdapter.

This commit is contained in:
Alex Ning 2020-07-13 22:57:30 +08:00
parent 83eea69459
commit cd108fbe55
8 changed files with 142 additions and 599 deletions

View File

@ -81,12 +81,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
ProgressBar mProgressBar;
@BindView(R.id.image_view_view_image_or_gif_activity)
BigImageView mImageView;
/*@BindView(R.id.image_view_view_image_or_gif_activity)
SubsamplingScaleImageView mImageView;
@BindView(R.id.gesture_layout_view_image_or_gif_activity)
GestureFrameLayout gestureLayout;
@BindView(R.id.gif_view_view_image_or_gif_activity)
GifImageView mGifView;*/
@BindView(R.id.load_image_error_linear_layout_view_image_or_gif_activity)
LinearLayout mLoadErrorLinearLayout;
@Inject

View File

@ -1268,7 +1268,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
CustomTarget<Bitmap> customTarget = new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
((PostDetailImageViewHolder) holder).mImageView.setImage(ImageSource.bitmap(resource));
((PostDetailImageViewHolder) holder).mImageView.setImage(ImageSource.cachedBitmap(resource));
}
@Override
@ -1907,6 +1907,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mGlide.clear(((PostDetailGifAutoplayViewHolder) holder).mImageView);
} else if (holder instanceof PostDetailImageViewHolder) {
mGlide.clear(((PostDetailImageViewHolder) holder).mImageView);
((PostDetailImageViewHolder) holder).mImageView.recycle();
} else if (holder instanceof PostDetailLinkViewHolder) {
mGlide.clear(((PostDetailLinkViewHolder) holder).mImageView);
}

View File

@ -5,7 +5,6 @@ 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;
@ -40,11 +39,7 @@ 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;
@ -83,7 +78,6 @@ 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;
@ -106,8 +100,7 @@ import retrofit2.Retrofit;
public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHolder> implements CacheManager {
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_GIF_AUTOPLAY_TYPE = 3;
private static final int VIEW_TYPE_POST_CARD_IMAGE_TYPE = 4;
private static final int VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_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;
@ -128,6 +121,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private AppCompatActivity mActivity;
private Retrofit mOauthRetrofit;
private Retrofit mRetrofit;
private int mImageViewWidth;
private String mAccessToken;
private RequestManager mGlide;
private RedditDataRoomDatabase mRedditDataRoomDatabase;
@ -189,15 +183,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
public PostRecyclerViewAdapter(AppCompatActivity activity, Retrofit oauthRetrofit, Retrofit retrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
CustomThemeWrapper customThemeWrapper, Locale locale, String accessToken,
int postType, int postLayout, boolean displaySubredditName,
SharedPreferences sharedPreferences, ExoCreator exoCreator,
Callback callback) {
CustomThemeWrapper customThemeWrapper, Locale locale, int imageViewWidth,
String accessToken, int postType, int postLayout, boolean displaySubredditName,
SharedPreferences sharedPreferences, ExoCreator exoCreator, Callback callback) {
super(DIFF_CALLBACK);
if (activity != null) {
mActivity = activity;
mOauthRetrofit = oauthRetrofit;
mRetrofit = retrofit;
mImageViewWidth = imageViewWidth;
mAccessToken = accessToken;
mPostType = postType;
mDisplaySubredditName = displaySubredditName;
@ -306,11 +300,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_GIF_AUTOPLAY_TYPE;
return VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE;
}
return VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE;
case Post.IMAGE_TYPE:
return VIEW_TYPE_POST_CARD_IMAGE_TYPE;
return VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE;
case Post.LINK_TYPE:
return VIEW_TYPE_POST_CARD_LINK_TYPE;
case Post.NO_PREVIEW_LINK_TYPE:
@ -333,10 +327,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
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_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_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_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) {
@ -568,21 +560,21 @@ 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 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) {
((PostImageViewHolder) holder).imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
((PostImageViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
} else if (holder instanceof PostImageAndGifAutoplayViewHolder) {
if (post.getPostType() == Post.IMAGE_TYPE) {
((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(R.string.image);
} else {
((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(R.string.gif);
}
((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
if (post.getPreviewWidth() <= 0 || post.getPreviewHeight() <= 0) {
((PostImageAndGifAutoplayViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
((PostImageAndGifAutoplayViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
} else {
((PostImageAndGifAutoplayViewHolder) holder).imageView
.setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
}
loadImage(holder, post);
} else if (holder instanceof PostLinkTypeViewHolder) {
((PostLinkTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostLinkTypeViewHolder) holder).imageView
@ -852,15 +844,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
private void loadImage(final RecyclerView.ViewHolder holder, final Post post) {
if (holder instanceof PostGifAutoplayViewHolder) {
mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
if (holder instanceof PostImageAndGifAutoplayViewHolder) {
String url = post.getPostType() == Post.IMAGE_TYPE ? post.getPreviewUrl() : post.getUrl();
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
((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);
((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);
loadImage(holder, post);
});
return false;
@ -868,49 +861,21 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
((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);
((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((PostImageAndGifAutoplayViewHolder) 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(customTarget);
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
} else {
imageRequestBuilder.apply(RequestOptions.noTransformation()).into(customTarget);
if (mImageViewWidth > post.getPreviewWidth()) {
imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
} else {
imageRequestBuilder.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
}
}
} else if (holder instanceof PostVideoAndGifPreviewViewHolder) {
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
@ -1119,15 +1084,11 @@ 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 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 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 PostVideoAndGifPreviewViewHolder) {
mGlide.clear(((PostVideoAndGifPreviewViewHolder) holder).imageView);
} else if (holder instanceof PostLinkTypeViewHolder) {
@ -1955,61 +1916,61 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
class PostGifAutoplayViewHolder extends PostBaseViewHolder {
@BindView(R.id.card_view_item_post_gif_autoplay)
class PostImageAndGifAutoplayViewHolder extends PostBaseViewHolder {
@BindView(R.id.card_view_item_post_image_and_gif_autoplay)
MaterialCardView cardView;
@BindView(R.id.icon_gif_image_view_item_post_gif_autoplay)
@BindView(R.id.icon_gif_image_view_item_post_image_and_gif_autoplay)
AspectRatioGifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_item_post_gif_autoplay)
@BindView(R.id.subreddit_name_text_view_item_post_image_and_gif_autoplay)
TextView subredditTextView;
@BindView(R.id.user_text_view_item_post_gif_autoplay)
@BindView(R.id.user_text_view_item_post_image_and_gif_autoplay)
TextView userTextView;
@BindView(R.id.stickied_post_image_view_item_post_gif_autoplay)
@BindView(R.id.stickied_post_image_view_item_post_image_and_gif_autoplay)
ImageView stickiedPostImageView;
@BindView(R.id.post_time_text_view_item_post_gif_autoplay)
@BindView(R.id.post_time_text_view_item_post_image_and_gif_autoplay)
TextView postTimeTextView;
@BindView(R.id.title_text_view_item_post_gif_autoplay)
@BindView(R.id.title_text_view_item_post_image_and_gif_autoplay)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post_gif_autoplay)
@BindView(R.id.type_text_view_item_post_image_and_gif_autoplay)
CustomTextView typeTextView;
@BindView(R.id.archived_image_view_item_post_gif_autoplay)
@BindView(R.id.archived_image_view_item_post_image_and_gif_autoplay)
ImageView archivedImageView;
@BindView(R.id.locked_image_view_item_post_gif_autoplay)
@BindView(R.id.locked_image_view_item_post_image_and_gif_autoplay)
ImageView lockedImageView;
@BindView(R.id.crosspost_image_view_item_post_gif_autoplay)
@BindView(R.id.crosspost_image_view_item_post_image_and_gif_autoplay)
ImageView crosspostImageView;
@BindView(R.id.nsfw_text_view_item_post_gif_autoplay)
@BindView(R.id.nsfw_text_view_item_post_image_and_gif_autoplay)
CustomTextView nsfwTextView;
@BindView(R.id.spoiler_custom_text_view_item_post_gif_autoplay)
@BindView(R.id.spoiler_custom_text_view_item_post_image_and_gif_autoplay)
CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post_gif_autoplay)
@BindView(R.id.flair_custom_text_view_item_post_image_and_gif_autoplay)
CustomTextView flairTextView;
@BindView(R.id.awards_text_view_item_post_gif_autoplay)
@BindView(R.id.awards_text_view_item_post_image_and_gif_autoplay)
CustomTextView awardsTextView;
@BindView(R.id.progress_bar_item_post_gif_autoplay)
@BindView(R.id.progress_bar_item_post_image_and_gif_autoplay)
ProgressBar progressBar;
@BindView(R.id.image_view_item_post_gif_autoplay)
@BindView(R.id.image_view_item_post_image_and_gif_autoplay)
AspectRatioGifImageView imageView;
@BindView(R.id.load_image_error_relative_layout_item_post_gif_autoplay)
@BindView(R.id.load_image_error_relative_layout_item_post_image_and_gif_autoplay)
RelativeLayout errorRelativeLayout;
@BindView(R.id.load_image_error_text_view_item_post_gif_autoplay)
@BindView(R.id.load_image_error_text_view_item_post_image_and_gif_autoplay)
TextView errorTextView;
@BindView(R.id.bottom_constraint_layout_item_post_gif_autoplay)
@BindView(R.id.bottom_constraint_layout_item_post_image_and_gif_autoplay)
ConstraintLayout bottomConstraintLayout;
@BindView(R.id.plus_button_item_post_gif_autoplay)
@BindView(R.id.plus_button_item_post_image_and_gif_autoplay)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_gif_autoplay)
@BindView(R.id.score_text_view_item_post_image_and_gif_autoplay)
TextView scoreTextView;
@BindView(R.id.minus_button_item_post_gif_autoplay)
@BindView(R.id.minus_button_item_post_image_and_gif_autoplay)
ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_gif_autoplay)
@BindView(R.id.comments_count_item_post_image_and_gif_autoplay)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post_gif_autoplay)
@BindView(R.id.save_button_item_post_image_and_gif_autoplay)
ImageView saveButton;
@BindView(R.id.share_button_item_post_gif_autoplay)
@BindView(R.id.share_button_item_post_image_and_gif_autoplay)
ImageView shareButton;
PostGifAutoplayViewHolder(View itemView) {
PostImageAndGifAutoplayViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
setBaseView(cardView,
@ -2041,109 +2002,21 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
imageView.setOnClickListener(view -> {
Post post = getItem(getAdapterPosition());
if (post != null) {
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);
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 {
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);
}
}
});
}

View File

@ -11,6 +11,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@ -242,6 +243,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
}
DisplayMetrics displayMetrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int windowWidth = displayMetrics.widthPixels;
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT && !resources.getBoolean(R.bool.isTablet)) {
mLinearLayoutManager = new LinearLayoutManager(activity);
mPostRecyclerView.setLayoutManager(mLinearLayoutManager);
@ -251,6 +256,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
StaggeredGridLayoutManagerItemOffsetDecoration itemDecoration =
new StaggeredGridLayoutManagerItemOffsetDecoration(activity, R.dimen.staggeredLayoutManagerItemOffset);
mPostRecyclerView.addItemDecoration(itemDecoration);
windowWidth /= 2;
}
mGlide = Glide.with(activity);
@ -361,7 +367,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, defaultPostLayout);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
customThemeWrapper, locale, accessToken, postType, postLayout, true,
customThemeWrapper, locale, windowWidth, accessToken, postType, postLayout, true,
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -423,7 +429,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
customThemeWrapper, locale, accessToken, postType, postLayout, displaySubredditName,
customThemeWrapper, locale, windowWidth, accessToken, postType, postLayout, displaySubredditName,
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -470,7 +476,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
customThemeWrapper, locale, accessToken, postType, postLayout, true,
customThemeWrapper, locale, windowWidth, accessToken, postType, postLayout, true,
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -515,7 +521,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + username, defaultPostLayout);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
customThemeWrapper, locale, accessToken, postType, postLayout, true,
customThemeWrapper, locale, windowWidth, accessToken, postType, postLayout, true,
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -553,7 +559,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, defaultPostLayout);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
customThemeWrapper, locale, accessToken, postType, postLayout, true,
customThemeWrapper, locale, windowWidth, accessToken, postType, postLayout, true,
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {

View File

@ -27,7 +27,6 @@
android:id="@+id/image_view_view_image_or_gif_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:initScaleType="fitCenter"
app:optimizeDisplay="true"
app:tapToRetry="false" />

View File

@ -204,8 +204,6 @@
android:id="@+id/image_view_item_post_detail_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
app:quickScaleEnabled="false"
app:zoomEnabled="false"
app:panEnabled="false" />

View File

@ -1,325 +0,0 @@
<?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>

View File

@ -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"
android:id="@+id/card_view_item_post_image_and_gif_autoplay"
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"
android:id="@+id/icon_gif_image_view_item_post_image_and_gif_autoplay"
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"
android:id="@+id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
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"
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_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_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/user_text_view_item_post_image"
android:id="@+id/user_text_view_item_post_image_and_gif_autoplay"
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"
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_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_constraintHorizontal_bias="0" />
<ImageView
android:id="@+id/stickied_post_image_view_item_post_image"
android:id="@+id/stickied_post_image_view_item_post_image_and_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_image"
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/post_time_text_view_item_post_image"
android:id="@+id/post_time_text_view_item_post_image_and_gif_autoplay"
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"
android:id="@+id/title_text_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@ -109,7 +109,7 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
android:id="@+id/type_text_view_item_post_image"
android:id="@+id/type_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@ -121,7 +121,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/spoiler_custom_text_view_item_post_image"
android:id="@+id/spoiler_custom_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -135,7 +135,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/nsfw_text_view_item_post_image"
android:id="@+id/nsfw_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@ -148,7 +148,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/flair_custom_text_view_item_post_image"
android:id="@+id/flair_custom_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -161,7 +161,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/awards_text_view_item_post_image"
android:id="@+id/awards_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@ -173,21 +173,21 @@
app:lib_setShape="rectangle" />
<ImageView
android:id="@+id/archived_image_view_item_post_image"
android:id="@+id/archived_image_view_item_post_image_and_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_image"
android:id="@+id/locked_image_view_item_post_image_and_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_image"
android:id="@+id/crosspost_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
@ -199,31 +199,28 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioSubsamplingScaleImageView
android:id="@+id/image_view_item_post_image"
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/image_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
app:quickScaleEnabled="false"
app:zoomEnabled="false"
app:panEnabled="false" />
android:scaleType="fitStart" />
<ProgressBar
android:id="@+id/progress_bar_item_post_image"
android:id="@+id/progress_bar_item_post_image_and_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_image"
android:id="@+id/load_image_error_relative_layout_item_post_image_and_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_image"
android:id="@+id/load_image_error_text_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@ -238,12 +235,12 @@
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_constraint_layout_item_post_image"
android:id="@+id/bottom_constraint_layout_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/plus_button_item_post_image"
android:id="@+id/plus_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@ -256,7 +253,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/score_text_view_item_post_image"
android:id="@+id/score_text_view_item_post_image_and_gif_autoplay"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@ -265,10 +262,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" />
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_and_gif_autoplay" />
<ImageView
android:id="@+id/minus_button_item_post_image"
android:id="@+id/minus_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@ -278,10 +275,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" />
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image_and_gif_autoplay" />
<TextView
android:id="@+id/comments_count_item_post_image"
android:id="@+id/comments_count_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@ -293,10 +290,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image" />
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image_and_gif_autoplay" />
<ImageView
android:id="@+id/save_button_item_post_image"
android:id="@+id/save_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@ -306,11 +303,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"
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image" />
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" />
<ImageView
android:id="@+id/share_button_item_post_image"
android:id="@+id/share_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"