aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-27 14:14:52 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-27 14:14:52 +0000
commitd34454ef7aeb2a74b7f7ebd2778295212fe76bb0 (patch)
treef6b8d5b8183ea79d17c787333d7bf981d377b884 /app
parentfe55d8816592067c79f74c656c00e80973a1438d (diff)
downloadinfinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar.gz
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar.bz2
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar.lz
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar.xz
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.tar.zst
infinity-for-reddit-d34454ef7aeb2a74b7f7ebd2778295212fe76bb0.zip
Continue optimizing class structures in PostRecyclerViewAdapter.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java1017
1 files changed, 375 insertions, 642 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index fc30b293..c13ea749 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -593,148 +593,186 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
@OptIn(markerClass = UnstableApi.class)
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
- if (holder instanceof PostBaseViewHolder) {
+ if (holder instanceof PostViewHolder) {
Post post = getItem(position);
- if (post != null) {
- ((PostBaseViewHolder) holder).post = post;
- ((PostBaseViewHolder) holder).currentPosition = position;
- if (post.isRead()) {
- if (((PostBaseViewHolder) holder).itemViewIsNotCardView) {
- holder.itemView.setBackgroundColor(mReadPostCardViewBackgroundColor);
- } else {
- holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
- }
-
- ((PostBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
- }
- String authorPrefixed = "u/" + post.getAuthor();
-
- if (mHideSubredditAndUserPrefix) {
- ((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
- ((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
- } else {
- ((PostBaseViewHolder) holder).subredditTextView.setText("r/" + post.getSubredditName());
- ((PostBaseViewHolder) holder).userTextView.setText(authorPrefixed);
- }
-
- ((PostBaseViewHolder) holder).userTextView.setTextColor(
- post.isModerator() ? mModeratorColor : mUsernameColor);
-
- if (mDisplaySubredditName) {
- if (authorPrefixed.equals(post.getSubredditNamePrefixed())) {
- if (post.getAuthorIconUrl() == null) {
- mFragment.loadIcon(post.getAuthor(), false, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && post.getAuthor().equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- }
+ if (post == null) {
+ return;
+ }
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
- }
+ if (mDisplaySubredditName) {
+ if (post.getAuthorNamePrefixed().equals(post.getSubredditNamePrefixed())) {
+ if (post.getAuthorIconUrl() == null) {
+ mFragment.loadIcon(post.getAuthor(), false, (subredditOrUserName, iconUrl) -> {
+ if (mActivity != null && getItemCount() > 0 && post.getAuthor().equals(subredditOrUserName)) {
+ if (iconUrl == null || iconUrl.equals("")) {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(((PostViewHolder) holder).iconGifImageView);
+ } else {
+ mGlide.load(iconUrl)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(((PostViewHolder) holder).iconGifImageView);
}
- });
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- }
- } else {
- if (post.getSubredditIconUrl() == null) {
- mFragment.loadIcon(post.getSubredditName(), true, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && post.getSubredditName().equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- }
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setSubredditIconUrl(iconUrl);
- }
+ if (holder.getBindingAdapterPosition() >= 0) {
+ post.setAuthorIconUrl(iconUrl);
}
- });
- } else if (!post.getSubredditIconUrl().equals("")) {
- mGlide.load(post.getSubredditIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
- }
+ }
+ });
+ } else if (!post.getAuthorIconUrl().equals("")) {
+ mGlide.load(post.getAuthorIconUrl())
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(((PostViewHolder) holder).iconGifImageView);
+ } else {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(((PostViewHolder) holder).iconGifImageView);
}
} else {
- if (post.getAuthorIconUrl() == null) {
- String authorName = post.isAuthorDeleted() ? post.getSubredditName() : post.getAuthor();
- mFragment.loadIcon(authorName, post.isAuthorDeleted(), (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0) {
- if (iconUrl == null || iconUrl.equals("") && authorName.equals(subredditOrUserName)) {
+ if (post.getSubredditIconUrl() == null) {
+ mFragment.loadIcon(post.getSubredditName(), true, (subredditOrUserName, iconUrl) -> {
+ if (mActivity != null && getItemCount() > 0 && post.getSubredditName().equals(subredditOrUserName)) {
+ if (iconUrl == null || iconUrl.equals("")) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
+ .into(((PostViewHolder) holder).iconGifImageView);
} else {
mGlide.load(iconUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
+ .into(((PostViewHolder) holder).iconGifImageView);
}
if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
+ post.setSubredditIconUrl(iconUrl);
}
}
});
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
+ } else if (!post.getSubredditIconUrl().equals("")) {
+ mGlide.load(post.getSubredditIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
+ .into(((PostViewHolder) holder).iconGifImageView);
} else {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostBaseViewHolder) holder).iconGifImageView);
+ .into(((PostViewHolder) holder).iconGifImageView);
}
}
+ } else {
+ if (post.getAuthorIconUrl() == null) {
+ String authorName = post.isAuthorDeleted() ? post.getSubredditName() : post.getAuthor();
+ mFragment.loadIcon(authorName, post.isAuthorDeleted(), (subredditOrUserName, iconUrl) -> {
+ if (mActivity != null && getItemCount() > 0) {
+ if (iconUrl == null || iconUrl.equals("") && authorName.equals(subredditOrUserName)) {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(((PostViewHolder) holder).iconGifImageView);
+ } else {
+ mGlide.load(iconUrl)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(((PostViewHolder) holder).iconGifImageView);
+ }
- if (mShowElapsedTime) {
- ((PostBaseViewHolder) holder).postTimeTextView.setText(
- Utils.getElapsedTime(mActivity, post.getPostTimeMillis()));
+ if (holder.getBindingAdapterPosition() >= 0) {
+ post.setAuthorIconUrl(iconUrl);
+ }
+ }
+ });
+ } else if (!post.getAuthorIconUrl().equals("")) {
+ mGlide.load(post.getAuthorIconUrl())
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(((PostViewHolder) holder).iconGifImageView);
} else {
- ((PostBaseViewHolder) holder).postTimeTextView.setText(Utils.getFormattedTime(mLocale, post.getPostTimeMillis(), mTimeFormatPattern));
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(((PostViewHolder) holder).iconGifImageView);
+ }
+ }
+
+ if (mShowElapsedTime) {
+ ((PostViewHolder) holder).postTimeTextView.setText(
+ Utils.getElapsedTime(mActivity, post.getPostTimeMillis()));
+ } else {
+ ((PostViewHolder) holder).postTimeTextView.setText(Utils.getFormattedTime(mLocale, post.getPostTimeMillis(), mTimeFormatPattern));
+ }
+
+ ((PostViewHolder) holder).titleTextView.setText(post.getTitle());
+ if (!mHideTheNumberOfVotes) {
+ ((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
+ } else {
+ ((PostViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
+ }
+
+ switch (post.getVoteType()) {
+ case 1:
+ //Upvoted
+ ((PostViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
+ ((PostViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
+ ((PostViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
+ break;
+ case -1:
+ //Downvoted
+ ((PostViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
+ ((PostViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
+ ((PostViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
+ break;
+ }
+
+ if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
+ ((PostViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
+ mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostViewHolder) holder).stickiedPostImageView);
+ }
+
+ if (!mHideTheNumberOfComments) {
+ ((PostViewHolder) holder).commentsCountButton.setVisibility(View.VISIBLE);
+ ((PostViewHolder) holder).commentsCountButton.setText(Integer.toString(post.getNComments()));
+ } else {
+ ((PostViewHolder) holder).commentsCountButton.setVisibility(View.GONE);
+ }
+
+ if (post.isSaved()) {
+ ((PostViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp);
+ } else {
+ ((PostViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp);
+ }
+
+
+
+ if (holder instanceof PostBaseViewHolder) {
+ ((PostBaseViewHolder) holder).post = post;
+ ((PostBaseViewHolder) holder).currentPosition = position;
+ if (post.isRead()) {
+ if (((PostBaseViewHolder) holder).itemViewIsNotCardView) {
+ holder.itemView.setBackgroundColor(mReadPostCardViewBackgroundColor);
+ } else {
+ holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
+ }
+
+ ((PostBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
}
- ((PostBaseViewHolder) holder).titleTextView.setText(post.getTitle());
- if (!mHideTheNumberOfVotes) {
- ((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
+ if (mHideSubredditAndUserPrefix) {
+ ((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
+ ((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
} else {
- ((PostBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
+ ((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditNamePrefixed());
+ ((PostBaseViewHolder) holder).userTextView.setText(post.getAuthorNamePrefixed());
}
+ ((PostBaseViewHolder) holder).userTextView.setTextColor(
+ post.isModerator() ? mModeratorColor : mUsernameColor);
+
if (post.isLocked()) {
((PostBaseViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE);
}
@@ -747,7 +785,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostBaseViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE);
}
- if (post.getFlair() != null && !post.getFlair().equals("")) {
+ if (post.getFlair() != null && !post.getFlair().isEmpty()) {
if (mHidePostFlair) {
((PostBaseViewHolder) holder).flairTextView.setVisibility(View.GONE);
} else {
@@ -756,26 +794,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
- switch (post.getVoteType()) {
- case 1:
- //Upvoted
- ((PostBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
- ((PostBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
- ((PostBaseViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
- break;
- case -1:
- //Downvoted
- ((PostBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
- ((PostBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
- ((PostBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
- break;
- }
-
- if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
- ((PostBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
- mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostBaseViewHolder) holder).stickiedPostImageView);
- }
-
if (post.isArchived()) {
((PostBaseViewHolder) holder).archivedImageView.setVisibility(View.VISIBLE);
@@ -788,19 +806,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostBaseViewHolder) holder).crosspostImageView.setVisibility(View.VISIBLE);
}
- if (!mHideTheNumberOfComments) {
- ((PostBaseViewHolder) holder).commentsCountButton.setVisibility(View.VISIBLE);
- ((PostBaseViewHolder) holder).commentsCountButton.setText(Integer.toString(post.getNComments()));
- } else {
- ((PostBaseViewHolder) holder).commentsCountButton.setVisibility(View.GONE);
- }
-
- if (post.isSaved()) {
- ((PostBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp);
- } else {
- ((PostBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp);
- }
-
if (mHidePostType) {
((PostBaseViewHolder) holder).typeTextView.setVisibility(View.GONE);
} else {
@@ -828,7 +833,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostBaseVideoAutoplayViewHolder) holder).toroPlayer.fetchRedgifsOrStreamableVideoCall =
mRedgifsRetrofit.create(RedgifsAPI.class)
.getRedgifsData(APIUtils.getRedgifsOAuthHeader(
- mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.REDGIFS_ACCESS_TOKEN, "")),
+ mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.REDGIFS_ACCESS_TOKEN, "")),
post.getRedgifsId(), APIUtils.USER_AGENT);
FetchRedgifsVideoLinks.fetchRedgifsVideoLinksInRecyclerViewAdapter(mExecutor, new Handler(),
((PostBaseVideoAutoplayViewHolder) holder).toroPlayer.fetchRedgifsOrStreamableVideoCall,
@@ -988,19 +993,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
mCallback.currentlyBindItem(holder.getBindingAdapterPosition());
- }
- } else if (holder instanceof PostCompactBaseViewHolder) {
- Post post = getItem(position);
- if (post != null) {
+ } else if (holder instanceof PostCompactBaseViewHolder) {
((PostCompactBaseViewHolder) holder).post = post;
((PostCompactBaseViewHolder) holder).currentPosition = position;
if (post.isRead()) {
holder.itemView.setBackgroundColor(mReadPostCardViewBackgroundColor);
((PostCompactBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
}
- final String subredditNamePrefixed = post.getSubredditNamePrefixed();
- String subredditName = subredditNamePrefixed.substring(2);
- String authorPrefixed = "u/" + post.getAuthor();
final String title = post.getTitle();
//TODO: why is voteType here?
int voteType = post.getVoteType();
@@ -1010,129 +1009,23 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
boolean isArchived = post.isArchived();
if (mDisplaySubredditName) {
- if (authorPrefixed.equals(subredditNamePrefixed)) {
- if (post.getAuthorIconUrl() == null) {
- mFragment.loadIcon(post.getAuthor(), false, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && post.getAuthor().equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
- } else {
- if (post.getSubredditIconUrl() == null) {
- mFragment.loadIcon(subredditName, true, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && subredditName.equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setSubredditIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getSubredditIconUrl().equals("")) {
- mGlide.load(post.getSubredditIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
- }
-
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor);
if (mHideSubredditAndUserPrefix) {
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName());
} else {
- ((PostCompactBaseViewHolder) holder).nameTextView.setText("r/" + post.getSubredditName());
+ ((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditNamePrefixed());
}
} else {
- if (post.getAuthorIconUrl() == null) {
- String authorName = post.isAuthorDeleted() ? post.getSubredditName() : post.getAuthor();
- mFragment.loadIcon(authorName, post.isAuthorDeleted(), (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && authorName.equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostCompactBaseViewHolder) holder).iconGifImageView);
- }
-
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(
post.isModerator() ? mModeratorColor : mUsernameColor);
if (mHideSubredditAndUserPrefix) {
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getAuthor());
} else {
- ((PostCompactBaseViewHolder) holder).nameTextView.setText(authorPrefixed);
+ ((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getAuthorNamePrefixed());
}
}
- if (mShowElapsedTime) {
- ((PostCompactBaseViewHolder) holder).postTimeTextView.setText(
- Utils.getElapsedTime(mActivity, post.getPostTimeMillis()));
- } else {
- ((PostCompactBaseViewHolder) holder).postTimeTextView.setText(Utils.getFormattedTime(mLocale, post.getPostTimeMillis(), mTimeFormatPattern));
- }
-
if (mCompactLayoutToolbarHiddenByDefault) {
ViewGroup.LayoutParams params = ((PostCompactBaseViewHolder) holder).bottomConstraintLayout.getLayoutParams();
params.height = 0;
@@ -1149,13 +1042,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).divider.setVisibility(View.GONE);
}
- ((PostCompactBaseViewHolder) holder).titleTextView.setText(title);
- if (!mHideTheNumberOfVotes) {
- ((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
- } else {
- ((PostCompactBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
- }
-
if (post.isLocked()) {
((PostCompactBaseViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE);
}
@@ -1177,21 +1063,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
- switch (post.getVoteType()) {
- case 1:
- //Upvoted
- ((PostCompactBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
- ((PostCompactBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
- ((PostCompactBaseViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
- break;
- case -1:
- //Downvoted
- ((PostCompactBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
- ((PostCompactBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
- ((PostCompactBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
- break;
- }
-
if (post.getPostType() != Post.TEXT_TYPE && post.getPostType() != Post.NO_PREVIEW_LINK_TYPE && !(mDataSavingMode && mDisableImagePreview)) {
((PostCompactBaseViewHolder) holder).relativeLayout.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.GALLERY_TYPE && post.getPreviews() != null && post.getPreviews().isEmpty()) {
@@ -1205,11 +1076,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
- if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
- ((PostCompactBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
- mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostCompactBaseViewHolder) holder).stickiedPostImageView);
- }
-
if (isArchived) {
((PostCompactBaseViewHolder) holder).archivedImageView.setVisibility(View.VISIBLE);
@@ -1292,387 +1158,32 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
break;
}
- if (!mHideTheNumberOfComments) {
- ((PostCompactBaseViewHolder) holder).commentsCountButton.setVisibility(View.VISIBLE);
- ((PostCompactBaseViewHolder) holder).commentsCountButton.setText(Integer.toString(post.getNComments()));
- } else {
- ((PostCompactBaseViewHolder) holder).commentsCountButton.setVisibility(View.GONE);
- }
-
- if (post.isSaved()) {
- ((PostCompactBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp);
- } else {
- ((PostCompactBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp);
- }
-
mCallback.currentlyBindItem(holder.getBindingAdapterPosition());
- }
- } else if (holder instanceof PostGalleryViewHolder) {
- Post post = getItem(position);
- if (post != null) {
- ((PostGalleryViewHolder) holder).post = post;
- ((PostGalleryViewHolder) holder).currentPosition = position;
- if (post.isRead()) {
- holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
- ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setTextColor(mReadPostTitleColor);
- }
-
- if (mDataSavingMode && (mDisableImagePreview ||
- ((post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE) && mOnlyDisablePreviewInVideoAndGifPosts))) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- if (post.getPostType() == Post.VIDEO_TYPE) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_video_day_night_24dp);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.GONE);
- } else if (post.getPostType() == Post.IMAGE_TYPE || post.getPostType() == Post.GIF_TYPE) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.GONE);
- } else if (post.getPostType() == Post.LINK_TYPE) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
- } else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_gallery_day_night_24dp);
- }
- } else {
- switch (post.getPostType()) {
- case Post.IMAGE_TYPE: {
- Post.Preview preview = getSuitablePreview(post.getPreviews());
- ((PostGalleryViewHolder) holder).preview = preview;
- if (preview != null) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
-
- if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
- int height = (int) (400 * mScale);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
- .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
- }
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
- loadImage(holder);
- }
- });
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
- }
- break;
- }
- case Post.GIF_TYPE: {
- if (post.getPostType() == Post.GIF_TYPE && ((post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit()) && !(mAutoplay && mAutoplayNsfwVideos)) || (post.isSpoiler() && mNeedBlurSpoiler))) {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
- } else {
- Post.Preview preview = getSuitablePreview(post.getPreviews());
- ((PostGalleryViewHolder) holder).preview = preview;
- if (preview != null) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
-
- if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
- int height = (int) (400 * mScale);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
- .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
- }
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
- loadImage(holder);
- }
- });
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
- }
- }
- break;
- }
- case Post.VIDEO_TYPE: {
- Post.Preview preview = getSuitablePreview(post.getPreviews());
- ((PostGalleryViewHolder) holder).preview = preview;
- if (preview != null) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
-
- if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
- int height = (int) (400 * mScale);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
- .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
- }
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
- loadImage(holder);
- }
- });
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_video_day_night_24dp);
- }
- break;
- }
- case Post.LINK_TYPE: {
- Post.Preview preview = getSuitablePreview(post.getPreviews());
- ((PostGalleryViewHolder) holder).preview = preview;
- if (preview != null) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator_day_night_24dp));
-
- if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
- int height = (int) (400 * mScale);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
- .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
- }
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
- loadImage(holder);
- }
- });
- } else {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
- }
- break;
- }
- case Post.NO_PREVIEW_LINK_TYPE: {
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
- break;
- }
- case Post.TEXT_TYPE: {
- ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setText(post.getTitle());
- break;
- }
- }
- }
- }
- } else if (holder instanceof PostGalleryBaseGalleryTypeViewHolder) {
- Post post = getItem(position);
- if (post != null) {
- ((PostGalleryBaseGalleryTypeViewHolder) holder).post = post;
- ((PostGalleryBaseGalleryTypeViewHolder) holder).currentPosition = position;
- if (post.isRead()) {
- holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
- }
-
- if (mDataSavingMode && mDisableImagePreview) {
- ((PostGalleryBaseGalleryTypeViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE);
- ((PostGalleryBaseGalleryTypeViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_day_night_24dp);
- } else {
- Post.Preview preview = getSuitablePreview(post.getPreviews());
- ((PostGalleryBaseGalleryTypeViewHolder) holder).preview = preview;
-
- ((PostGalleryBaseGalleryTypeViewHolder) holder).frameLayout.setVisibility(View.VISIBLE);
- ((PostGalleryBaseGalleryTypeViewHolder) holder).imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, 1, post.getGallery().size()));
- if (preview != null) {
- if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
- ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
- } else {
- ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
- }
- } else {
- ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
- }
- ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setGalleryImages(post.getGallery());
- ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setBlurImage(
- (post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (post.isSpoiler() && mNeedBlurSpoiler));
- }
- }
- } else if (holder instanceof PostMaterial3CardBaseViewHolder) {
- Post post = getItem(position);
- if (post != null) {
+ } else if (holder instanceof PostMaterial3CardBaseViewHolder) {
((PostMaterial3CardBaseViewHolder) holder).post = post;
((PostMaterial3CardBaseViewHolder) holder).currentPosition = position;
if (post.isRead()) {
holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostFilledCardViewBackgroundColor));
((PostMaterial3CardBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
}
- String authorPrefixed = "u/" + post.getAuthor();
if (mHideSubredditAndUserPrefix) {
((PostMaterial3CardBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
((PostMaterial3CardBaseViewHolder) holder).userTextView.setText(post.getAuthor());
} else {
- ((PostMaterial3CardBaseViewHolder) holder).subredditTextView.setText("r/" + post.getSubredditName());
- ((PostMaterial3CardBaseViewHolder) holder).userTextView.setText(authorPrefixed);
+ ((PostMaterial3CardBaseViewHolder) holder).subredditTextView.setText(post.getSubredditNamePrefixed());
+ ((PostMaterial3CardBaseViewHolder) holder).userTextView.setText(post.getAuthorNamePrefixed());
}
((PostMaterial3CardBaseViewHolder) holder).userTextView.setTextColor(
post.isModerator() ? mModeratorColor : mUsernameColor);
- if (mDisplaySubredditName) {
- if (authorPrefixed.equals(post.getSubredditNamePrefixed())) {
- if (post.getAuthorIconUrl() == null) {
- mFragment.loadIcon(post.getAuthor(), false, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && post.getAuthor().equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
- } else {
- if (post.getSubredditIconUrl() == null) {
- mFragment.loadIcon(post.getSubredditName(), true, (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0 && post.getSubredditName().equals(subredditOrUserName)) {
- if (iconUrl == null || iconUrl.equals("")) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setSubredditIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getSubredditIconUrl().equals("")) {
- mGlide.load(post.getSubredditIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
- }
- } else {
- if (post.getAuthorIconUrl() == null) {
- String authorName = post.isAuthorDeleted() ? post.getSubredditName() : post.getAuthor();
- mFragment.loadIcon(authorName, post.isAuthorDeleted(), (subredditOrUserName, iconUrl) -> {
- if (mActivity != null && getItemCount() > 0) {
- if (iconUrl == null || iconUrl.equals("") && authorName.equals(subredditOrUserName)) {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(iconUrl)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
-
- if (holder.getBindingAdapterPosition() >= 0) {
- post.setAuthorIconUrl(iconUrl);
- }
- }
- });
- } else if (!post.getAuthorIconUrl().equals("")) {
- mGlide.load(post.getAuthorIconUrl())
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .error(mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- } else {
- mGlide.load(R.drawable.subreddit_default_icon)
- .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostMaterial3CardBaseViewHolder) holder).iconGifImageView);
- }
- }
-
- if (mShowElapsedTime) {
- ((PostMaterial3CardBaseViewHolder) holder).postTimeTextView.setText(
- Utils.getElapsedTime(mActivity, post.getPostTimeMillis()));
- } else {
- ((PostMaterial3CardBaseViewHolder) holder).postTimeTextView.setText(Utils.getFormattedTime(mLocale, post.getPostTimeMillis(), mTimeFormatPattern));
- }
-
- ((PostMaterial3CardBaseViewHolder) holder).titleTextView.setText(post.getTitle());
- if (!mHideTheNumberOfVotes) {
- ((PostMaterial3CardBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
- } else {
- ((PostMaterial3CardBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
- }
-
- switch (post.getVoteType()) {
- case 1:
- //Upvoted
- ((PostMaterial3CardBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
- ((PostMaterial3CardBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
- ((PostMaterial3CardBaseViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
- break;
- case -1:
- //Downvoted
- ((PostMaterial3CardBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
- ((PostMaterial3CardBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
- ((PostMaterial3CardBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
- break;
- }
-
- if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
- ((PostMaterial3CardBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
- mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostMaterial3CardBaseViewHolder) holder).stickiedPostImageView);
- }
-
if (post.isArchived()) {
((PostMaterial3CardBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor));
((PostMaterial3CardBaseViewHolder) holder).scoreTextView.setTextColor(mVoteAndReplyUnavailableVoteButtonColor);
((PostMaterial3CardBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor));
}
- if (!mHideTheNumberOfComments) {
- ((PostMaterial3CardBaseViewHolder) holder).commentsCountButton.setVisibility(View.VISIBLE);
- ((PostMaterial3CardBaseViewHolder) holder).commentsCountButton.setText(Integer.toString(post.getNComments()));
- } else {
- ((PostMaterial3CardBaseViewHolder) holder).commentsCountButton.setVisibility(View.GONE);
- }
-
- if (post.isSaved()) {
- ((PostMaterial3CardBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp);
- } else {
- ((PostMaterial3CardBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp);
- }
-
if (holder instanceof PostMaterial3CardBaseVideoAutoplayViewHolder) {
((PostMaterial3CardBaseVideoAutoplayViewHolder) holder).toroPlayer.previewImageView.setVisibility(View.VISIBLE);
Post.Preview preview = getSuitablePreview(post.getPreviews());
@@ -1852,6 +1363,198 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mCallback.currentlyBindItem(holder.getBindingAdapterPosition());
}
}
+
+ if (holder instanceof PostGalleryViewHolder) {
+ Post post = getItem(position);
+ if (post != null) {
+ ((PostGalleryViewHolder) holder).post = post;
+ ((PostGalleryViewHolder) holder).currentPosition = position;
+ if (post.isRead()) {
+ holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
+ ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setTextColor(mReadPostTitleColor);
+ }
+
+ if (mDataSavingMode && (mDisableImagePreview ||
+ ((post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE) && mOnlyDisablePreviewInVideoAndGifPosts))) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ if (post.getPostType() == Post.VIDEO_TYPE) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_video_day_night_24dp);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.GONE);
+ } else if (post.getPostType() == Post.IMAGE_TYPE || post.getPostType() == Post.GIF_TYPE) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.GONE);
+ } else if (post.getPostType() == Post.LINK_TYPE) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
+ } else if (post.getPostType() == Post.GALLERY_TYPE) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_gallery_day_night_24dp);
+ }
+ } else {
+ switch (post.getPostType()) {
+ case Post.IMAGE_TYPE: {
+ Post.Preview preview = getSuitablePreview(post.getPreviews());
+ ((PostGalleryViewHolder) holder).preview = preview;
+ if (preview != null) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
+
+ if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
+ int height = (int) (400 * mScale);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
+ .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
+ }
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
+ loadImage(holder);
+ }
+ });
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
+ }
+ break;
+ }
+ case Post.GIF_TYPE: {
+ if (post.getPostType() == Post.GIF_TYPE && ((post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit()) && !(mAutoplay && mAutoplayNsfwVideos)) || (post.isSpoiler() && mNeedBlurSpoiler))) {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
+ } else {
+ Post.Preview preview = getSuitablePreview(post.getPreviews());
+ ((PostGalleryViewHolder) holder).preview = preview;
+ if (preview != null) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
+
+ if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
+ int height = (int) (400 * mScale);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
+ .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
+ }
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
+ loadImage(holder);
+ }
+ });
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_image_day_night_24dp);
+ }
+ }
+ break;
+ }
+ case Post.VIDEO_TYPE: {
+ Post.Preview preview = getSuitablePreview(post.getPreviews());
+ ((PostGalleryViewHolder) holder).preview = preview;
+ if (preview != null) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
+
+ if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
+ int height = (int) (400 * mScale);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
+ .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
+ }
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
+ loadImage(holder);
+ }
+ });
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_video_day_night_24dp);
+ }
+ break;
+ }
+ case Post.LINK_TYPE: {
+ Post.Preview preview = getSuitablePreview(post.getPreviews());
+ ((PostGalleryViewHolder) holder).preview = preview;
+ if (preview != null) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostGallery.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator_day_night_24dp));
+
+ if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
+ int height = (int) (400 * mScale);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.getLayoutParams().height = height;
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery
+ .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
+ }
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ ((PostGalleryViewHolder) holder).binding.imageViewItemPostGallery.removeOnLayoutChangeListener(this);
+ loadImage(holder);
+ }
+ });
+ } else {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
+ }
+ break;
+ }
+ case Post.NO_PREVIEW_LINK_TYPE: {
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.imageViewNoPreviewItemPostGallery.setImageResource(R.drawable.ic_link_day_night_24dp);
+ break;
+ }
+ case Post.TEXT_TYPE: {
+ ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setVisibility(View.VISIBLE);
+ ((PostGalleryViewHolder) holder).binding.titleTextViewItemPostGallery.setText(post.getTitle());
+ break;
+ }
+ }
+ }
+ }
+ } else if (holder instanceof PostGalleryBaseGalleryTypeViewHolder) {
+ Post post = getItem(position);
+ if (post != null) {
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).post = post;
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).currentPosition = position;
+ if (post.isRead()) {
+ holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
+ }
+
+ if (mDataSavingMode && mDisableImagePreview) {
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE);
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_day_night_24dp);
+ } else {
+ Post.Preview preview = getSuitablePreview(post.getPreviews());
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).preview = preview;
+
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).frameLayout.setVisibility(View.VISIBLE);
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, 1, post.getGallery().size()));
+ if (preview != null) {
+ if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
+ } else {
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
+ }
+ } else {
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
+ }
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setGalleryImages(post.getGallery());
+ ((PostGalleryBaseGalleryTypeViewHolder) holder).adapter.setBlurImage(
+ (post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (post.isSpoiler() && mNeedBlurSpoiler));
+ }
+ }
+ }
}
@Nullable
@@ -2469,6 +2172,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
public abstract class PostViewHolder extends RecyclerView.ViewHolder {
AspectRatioGifImageView iconGifImageView;
+ ImageView stickiedPostImageView;
+ TextView postTimeTextView;
+ TextView titleTextView;
MaterialButton upvoteButton;
TextView scoreTextView;
MaterialButton downvoteButton;
@@ -2483,6 +2189,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
void setBaseView(AspectRatioGifImageView iconGifImageView,
TextView subredditTextView,
TextView userTextView,
+ ImageView stickiedPostImageView,
+ TextView postTimeTextView,
+ TextView titleTextView,
MaterialButton upvoteButton,
TextView scoreTextView,
MaterialButton downvoteButton,
@@ -2490,6 +2199,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
MaterialButton saveButton,
MaterialButton shareButton) {
this.iconGifImageView = iconGifImageView;
+ this.stickiedPostImageView = stickiedPostImageView;
+ this.postTimeTextView = postTimeTextView;
+ this.titleTextView = titleTextView;
this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView;
this.downvoteButton = downvoteButton;
@@ -2566,6 +2278,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
void setBaseView(AspectRatioGifImageView iconGifImageView,
TextView subredditTextView,
TextView userTextView,
+ ImageView stickiedPostImageView,
+ TextView postTimeTextView,
+ TextView titleTextView,
CustomTextView typeTextView,
CustomTextView nsfwTextView,
CustomTextView flairTextView,
@@ -2576,6 +2291,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
MaterialButton saveButton,
MaterialButton shareButton) {
this.iconGifImageView = iconGifImageView;
+ this.stickiedPostImageView = stickiedPostImageView;
+ this.postTimeTextView = postTimeTextView;
+ this.titleTextView = titleTextView;
this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView;
this.downvoteButton = downvoteButton;
@@ -2654,6 +2372,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
void setBaseView(AspectRatioGifImageView iconGifImageView,
TextView nameTextView,
+ ImageView stickiedPostImageView,
+ TextView postTimeTextView,
+ TextView titleTextView,
CustomTextView typeTextView,
CustomTextView nsfwTextView,
CustomTextView flairTextView,
@@ -2664,6 +2385,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
MaterialButton saveButton,
MaterialButton shareButton) {
this.iconGifImageView = iconGifImageView;
+ this.stickiedPostImageView = stickiedPostImageView;
+ this.postTimeTextView = postTimeTextView;
+ this.titleTextView = titleTextView;
this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView;
this.downvoteButton = downvoteButton;
@@ -3401,6 +3125,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
iconGifImageView,
subredditTextView,
userTextView,
+ stickiedPostImageView,
+ postTimeTextView,
+ titleTextView,
typeTextView,
nsfwTextView,
flairTextView,
@@ -4272,6 +3999,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
View divider) {
super.setBaseView(iconGifImageView,
nameTextView,
+ stickiedPostImageView,
+ postTimeTextView,
+ titleTextView,
typeTextView,
nsfwTextView,
flairTextView,
@@ -5023,6 +4753,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
super.setBaseView(iconGifImageView,
subredditTextView,
userTextView,
+ stickiedPostImageView,
+ postTimeTextView,
+ titleTextView,
upvoteButton,
scoreTextView,
downvoteButton,