aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java53
1 files changed, 25 insertions, 28 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 a2f523e8..77fecdf3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -612,7 +612,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
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("")) {
+ if (iconUrl == null || iconUrl.isEmpty()) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.into(((PostViewHolder) holder).iconGifImageView);
@@ -629,7 +629,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
});
- } else if (!post.getAuthorIconUrl().equals("")) {
+ } else if (!post.getAuthorIconUrl().isEmpty()) {
mGlide.load(post.getAuthorIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
@@ -644,7 +644,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
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("")) {
+ if (iconUrl == null || iconUrl.isEmpty()) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.into(((PostViewHolder) holder).iconGifImageView);
@@ -661,7 +661,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
});
- } else if (!post.getSubredditIconUrl().equals("")) {
+ } else if (!post.getSubredditIconUrl().isEmpty()) {
mGlide.load(post.getSubredditIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
@@ -678,7 +678,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
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 (iconUrl == null || iconUrl.isEmpty() && authorName.equals(subredditOrUserName)) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.into(((PostViewHolder) holder).iconGifImageView);
@@ -695,7 +695,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
});
- } else if (!post.getAuthorIconUrl().equals("")) {
+ } else if (!post.getAuthorIconUrl().isEmpty()) {
mGlide.load(post.getAuthorIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
@@ -738,7 +738,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostViewHolder) holder).nsfwTextView.setVisibility(View.VISIBLE);
}
- if (post.isSpoiler()) {
+ if (((PostViewHolder) holder).spoilerTextView != null && post.isSpoiler()) {
((PostViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE);
}
@@ -941,7 +941,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
(post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (post.isSpoiler() && mNeedBlurSpoiler));
}
} else if (holder instanceof PostTextTypeViewHolder) {
- if (!mHideTextPostContent && !post.isSpoiler() && post.getSelfTextPlainTrimmed() != null && !post.getSelfTextPlainTrimmed().equals("")) {
+ if (!mHideTextPostContent && !post.isSpoiler() && post.getSelfTextPlainTrimmed() != null && !post.getSelfTextPlainTrimmed().isEmpty()) {
((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.VISIBLE);
if (post.isRead()) {
((PostTextTypeViewHolder) holder).contentTextView.setTextColor(mReadPostContentColor);
@@ -1941,7 +1941,11 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
TextView postTimeTextView,
TextView titleTextView,
@Nullable CustomTextView typeTextView,
+ @Nullable ImageView archivedImageView,
+ @Nullable ImageView lockedImageView,
+ @Nullable ImageView crosspostImageView,
@Nullable CustomTextView nsfwTextView,
+ @Nullable CustomTextView spoilerTextView,
@Nullable CustomTextView flairTextView,
MaterialButton upvoteButton,
TextView scoreTextView,
@@ -1953,6 +1957,15 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
this.stickiedPostImageView = stickiedPostImageView;
this.postTimeTextView = postTimeTextView;
this.titleTextView = titleTextView;
+
+ this.typeTextView = typeTextView;
+ this.archivedImageView = archivedImageView;
+ this.lockedImageView = lockedImageView;
+ this.crosspostImageView = crosspostImageView;
+ this.nsfwTextView = nsfwTextView;
+ this.spoilerTextView = spoilerTextView;
+ this.flairTextView = flairTextView;
+
this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView;
this.downvoteButton = downvoteButton;
@@ -3581,17 +3594,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
public class PostCompactBaseViewHolder extends PostViewHolder {
TextView nameTextView;
- ImageView stickiedPostImageView;
- TextView postTimeTextView;
ConstraintLayout titleAndImageConstraintLayout;
- TextView titleTextView;
- CustomTextView typeTextView;
- ImageView archivedImageView;
- ImageView lockedImageView;
- ImageView crosspostImageView;
- CustomTextView nsfwTextView;
- CustomTextView spoilerTextView;
- CustomTextView flairTextView;
TextView linkTextView;
RelativeLayout relativeLayout;
ProgressBar progressBar;
@@ -3643,7 +3646,11 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
postTimeTextView,
titleTextView,
typeTextView,
+ archivedImageView,
+ lockedImageView,
+ crosspostImageView,
nsfwTextView,
+ spoilerTextView,
flairTextView,
upvoteButton,
scoreTextView,
@@ -3653,17 +3660,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
shareButton);
this.nameTextView = nameTextView;
- this.stickiedPostImageView = stickiedPostImageView;
- this.postTimeTextView = postTimeTextView;
this.titleAndImageConstraintLayout = titleAndImageConstraintLayout;
- this.titleTextView = titleTextView;
- this.typeTextView = typeTextView;
- this.archivedImageView = archivedImageView;
- this.lockedImageView = lockedImageView;
- this.crosspostImageView = crosspostImageView;
- this.nsfwTextView = nsfwTextView;
- this.spoilerTextView = spoilerTextView;
- this.flairTextView = flairTextView;
this.linkTextView = linkTextView;
this.relativeLayout = relativeLayout;
this.progressBar = progressBar;