aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-03-17 14:51:45 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-03-17 14:51:45 +0000
commit9b796cf6219f147f39a2c3b37dfecbf811d16750 (patch)
treec6d1ff15c942b0a10f9ed3ae07606026e45a8daf
parent3dc2d9fee215449c7730bade75781c044565a138 (diff)
downloadinfinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar.gz
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar.bz2
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar.lz
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar.xz
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.tar.zst
infinity-for-reddit-9b796cf6219f147f39a2c3b37dfecbf811d16750.zip
Fix unable to vote.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java8
2 files changed, 7 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index 5d7e2b79..a9c48b31 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -1392,8 +1392,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
});
}
});
- } else if (holder instanceof LoadMoreCommentsFailedViewHolder) {
- ((LoadMoreCommentsFailedViewHolder) holder).errorTextView.setText(R.string.load_comments_failed);
}
}
@@ -1872,7 +1870,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousUpvoteButtonColorFilter == null) {
+ if (previousVoteType != 1) {
//Not upvoted before
mPost.setVoteType(1);
newVoteType = RedditUtils.DIR_UPVOTE;
@@ -1946,7 +1944,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousDownvoteButtonColorFilter == null) {
+ if (previousVoteType != -1) {
//Not upvoted before
mPost.setVoteType(-1);
newVoteType = RedditUtils.DIR_DOWNVOTE;
@@ -2209,6 +2207,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
LoadMoreCommentsFailedViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
+ errorTextView.setText(R.string.load_comments_failed);
retryButton.setOnClickListener(view -> mCommentRecyclerViewAdapterCallback.retryFetchingMoreComments());
itemView.setBackgroundColor(mCommentBackgroundColor);
errorTextView.setTextColor(mSecondaryTextColor);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 77f990a2..c374282d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -609,7 +609,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousUpvoteButtonColorFilter == null) {
+ if (previousVoteType != 1) {
//Not upvoted before
post.setVoteType(1);
newVoteType = RedditUtils.DIR_UPVOTE;
@@ -680,7 +680,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousDownvoteButtonColorFilter == null) {
+ if (previousVoteType != -1) {
//Not downvoted before
post.setVoteType(-1);
newVoteType = RedditUtils.DIR_DOWNVOTE;
@@ -1155,7 +1155,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousUpvoteButtonColorFilter == null) {
+ if (previousVoteType != 1) {
//Not upvoted before
post.setVoteType(1);
newVoteType = RedditUtils.DIR_UPVOTE;
@@ -1226,7 +1226,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousDownvoteButtonColorFilter == null) {
+ if (previousVoteType != -1) {
//Not downvoted before
post.setVoteType(-1);
newVoteType = RedditUtils.DIR_DOWNVOTE;