Fix unable to vote.

This commit is contained in:
Alex Ning 2020-03-17 22:51:45 +08:00
parent 3dc2d9fee2
commit 9b796cf621
2 changed files with 7 additions and 8 deletions

View File

@ -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);

View File

@ -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;