Post detail up/downvote separation

This commit separates the up and downvote values on a post detail page.
This commit is contained in:
Bazsalanszky 2023-08-10 17:17:08 +02:00
parent dd00802561
commit 6a4aa8075d
11 changed files with 242 additions and 26 deletions

View File

@ -15,6 +15,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.Spanned; import android.text.Spanned;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -172,6 +173,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private boolean mHideTheNumberOfAwards; private boolean mHideTheNumberOfAwards;
private boolean mHideSubredditAndUserPrefix; private boolean mHideSubredditAndUserPrefix;
private boolean mHideTheNumberOfVotes; private boolean mHideTheNumberOfVotes;
private boolean mSeperateUpvoteAndDownvote;
private boolean mHideTheNumberOfComments; private boolean mHideTheNumberOfComments;
private boolean mSeparatePostAndComments; private boolean mSeparatePostAndComments;
private boolean mLegacyAutoplayVideoControllerUI; private boolean mLegacyAutoplayVideoControllerUI;
@ -342,6 +345,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false); mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false); mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false); mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true);
mHideTheNumberOfComments = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false); mHideTheNumberOfComments = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false);
mPostDetailRecyclerViewAdapterCallback = postDetailRecyclerViewAdapterCallback; mPostDetailRecyclerViewAdapterCallback = postDetailRecyclerViewAdapterCallback;
@ -544,16 +548,23 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
//Upvote //Upvote
((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN); ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN);
((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mUpvotedColor); ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mUpvotedColor);
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setTextColor(mPostIconAndInfoColor);
break; break;
case -1: case -1:
//Downvote //Downvote
((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor); if(mSeperateUpvoteAndDownvote){
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setTextColor(mDownvotedColor);
} else {
((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor);
}
break; break;
default:
case 0: case 0:
((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor); ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
if (mPost.isArchived()) { if (mPost.isArchived()) {
@ -611,7 +622,24 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
} }
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
((PostDetailBaseViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); if(mSeperateUpvoteAndDownvote){
int upvotes = (mPost.getVoteType() == 1) ? mPost.getUpvotes()+1 : mPost.getUpvotes();
int downvotes = (mPost.getVoteType() == -1) ? mPost.getDownvotes() +1 : Math.max(mPost.getDownvotes(),0);
((PostDetailBaseViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setVisibility(View.VISIBLE);
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setGravity(Gravity.START);
((PostDetailBaseViewHolder) holder).mScoreTextView.setGravity(Gravity.START);
((PostDetailBaseViewHolder) holder).mScoreTextView.getLayoutParams().width = (int) (32 * mActivity.getResources().getDisplayMetrics().density);
((PostDetailBaseViewHolder) holder).mScoreTextView.setPadding(0, 0, 6, 0);
((PostDetailBaseViewHolder) holder).mDownvoteTextView.setPadding(0, 0, 12, 0);
((PostDetailBaseViewHolder) holder).mUpvoteButton.setPadding(24, 0, 12, 0);
} else {
((PostDetailBaseViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType()));
}
} else { } else {
((PostDetailBaseViewHolder) holder).mScoreTextView.setText(mActivity.getString(R.string.vote)); ((PostDetailBaseViewHolder) holder).mScoreTextView.setText(mActivity.getString(R.string.vote));
} }
@ -1163,6 +1191,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ConstraintLayout mBottomConstraintLayout; ConstraintLayout mBottomConstraintLayout;
ImageView mUpvoteButton; ImageView mUpvoteButton;
TextView mScoreTextView; TextView mScoreTextView;
TextView mDownvoteTextView;
ImageView mDownvoteButton; ImageView mDownvoteButton;
TextView commentsCountTextView; TextView commentsCountTextView;
ImageView mSaveButton; ImageView mSaveButton;
@ -1191,6 +1220,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ConstraintLayout mBottomConstraintLayout, ConstraintLayout mBottomConstraintLayout,
ImageView mUpvoteButton, ImageView mUpvoteButton,
TextView mScoreTextView, TextView mScoreTextView,
TextView mDownvoteTextView,
ImageView mDownvoteButton, ImageView mDownvoteButton,
TextView commentsCountTextView, TextView commentsCountTextView,
ImageView mSaveButton, ImageView mSaveButton,
@ -1214,6 +1244,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
this.mBottomConstraintLayout = mBottomConstraintLayout; this.mBottomConstraintLayout = mBottomConstraintLayout;
this.mUpvoteButton = mUpvoteButton; this.mUpvoteButton = mUpvoteButton;
this.mScoreTextView = mScoreTextView; this.mScoreTextView = mScoreTextView;
this.mDownvoteTextView = mDownvoteTextView;
this.mDownvoteButton = mDownvoteButton; this.mDownvoteButton = mDownvoteButton;
this.commentsCountTextView = commentsCountTextView; this.commentsCountTextView = commentsCountTextView;
this.mSaveButton = mSaveButton; this.mSaveButton = mSaveButton;
@ -1306,6 +1337,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
int newVoteType; int newVoteType;
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
mDownvoteTextView.setTextColor(mPostIconAndInfoColor);
if (previousVoteType != 1) { if (previousVoteType != 1) {
//Not upvoted before //Not upvoted before
@ -1322,8 +1354,15 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
} }
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote){
mPost.getScore() + mPost.getVoteType())); int upvotes = (mPost.getVoteType() == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (mPost.getVoteType() == -1) ? mPost.getDownvotes() + 1 : Math.max(mPost.getDownvotes(),0);;
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType()));
}
} }
mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
@ -1343,8 +1382,15 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote){
mPost.getScore() + mPost.getVoteType())); int upvotes = (mPost.getVoteType() == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (mPost.getVoteType() == -1) ? mPost.getDownvotes() + 1 : Math.max(mPost.getDownvotes(),0);;
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType()));
}
} }
mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
@ -1355,8 +1401,15 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show();
mPost.setVoteType(previousVoteType); mPost.setVoteType(previousVoteType);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote){
mPost.getScore() + previousVoteType)); int upvotes = (previousVoteType == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (previousVoteType == -1) ? mPost.getDownvotes() - 1 : Math.max(mPost.getDownvotes(),0);;
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + previousVoteType));
}
} }
mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter); mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter);
mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter); mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter);
@ -1386,24 +1439,36 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
int newVoteType; int newVoteType;
mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mPostIconAndInfoColor);
if (previousVoteType != -1) { if (previousVoteType != -1) {
//Not upvoted before //Not upvoted before
mPost.setVoteType(-1); mPost.setVoteType(-1);
newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE);
mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mDownvotedColor); if(mSeperateUpvoteAndDownvote){
mDownvoteTextView.setTextColor(mDownvotedColor);
} else {
mScoreTextView.setTextColor(mDownvotedColor);
}
} else { } else {
//Upvoted before //Upvoted before
mPost.setVoteType(0); mPost.setVoteType(0);
newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE);
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mPostIconAndInfoColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
mDownvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote){
mPost.getScore() + mPost.getVoteType())); int upvotes = (mPost.getVoteType() == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (mPost.getVoteType() == -1) ? mPost.getDownvotes() + 1 : Math.max(mPost.getDownvotes(),0);;
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType()));
}
} }
mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
@ -1414,17 +1479,29 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
if (newVoteType == Integer.parseInt(APIUtils.DIR_DOWNVOTE)) { if (newVoteType == Integer.parseInt(APIUtils.DIR_DOWNVOTE)) {
mPost.setVoteType(-1); mPost.setVoteType(-1);
mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mDownvotedColor); if(mSeperateUpvoteAndDownvote) {
mDownvoteTextView.setTextColor(mDownvotedColor);
} else {
mScoreTextView.setTextColor(mDownvotedColor);
}
} else { } else {
mPost.setVoteType(0); mPost.setVoteType(0);
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mPostIconAndInfoColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
mDownvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote){
mPost.getScore() + mPost.getVoteType())); int upvotes = (mPost.getVoteType() == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (mPost.getVoteType() == -1) ? mPost.getDownvotes() + 1 : Math.max(mPost.getDownvotes(),0);;
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType()));
}
} }
mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
@ -1435,8 +1512,15 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show();
mPost.setVoteType(previousVoteType); mPost.setVoteType(previousVoteType);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, if(mSeperateUpvoteAndDownvote) {
mPost.getScore() + previousVoteType)); int upvotes = (previousVoteType == 1) ? mPost.getUpvotes() + 1 : mPost.getUpvotes();
int downvotes = (previousVoteType == -1) ? mPost.getDownvotes() + 1 : Math.max(mPost.getDownvotes(),0);
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
mDownvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + previousVoteType));
}
} }
mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter); mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter);
mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter); mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter);
@ -1683,6 +1767,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_video_autoplay) @BindView(R.id.score_text_view_item_post_detail_video_autoplay)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_video_autoplay)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_video_autoplay) @BindView(R.id.minus_button_item_post_detail_video_autoplay)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_video_autoplay) @BindView(R.id.comments_count_item_post_detail_video_autoplay)
@ -1721,6 +1808,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -1982,6 +2070,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_video_and_gif_preview) @BindView(R.id.score_text_view_item_post_detail_video_and_gif_preview)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_video_and_gif_preview)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_video_and_gif_preview) @BindView(R.id.minus_button_item_post_detail_video_and_gif_preview)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_video_and_gif_preview) @BindView(R.id.comments_count_item_post_detail_video_and_gif_preview)
@ -2013,6 +2104,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -2111,6 +2203,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_image_and_gif_autoplay) @BindView(R.id.score_text_view_item_post_detail_image_and_gif_autoplay)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_image_and_gif_autoplay)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_image_and_gif_autoplay) @BindView(R.id.minus_button_item_post_detail_image_and_gif_autoplay)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_image_and_gif_autoplay) @BindView(R.id.comments_count_item_post_detail_image_and_gif_autoplay)
@ -2142,6 +2237,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -2226,6 +2322,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_link) @BindView(R.id.score_text_view_item_post_detail_link)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_link)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_link) @BindView(R.id.minus_button_item_post_detail_link)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_link) @BindView(R.id.comments_count_item_post_detail_link)
@ -2257,6 +2356,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -2322,6 +2422,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_no_preview_link) @BindView(R.id.score_text_view_item_post_detail_no_preview_link)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_no_preview_link)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_no_preview_link) @BindView(R.id.minus_button_item_post_detail_no_preview_link)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_no_preview_link) @BindView(R.id.comments_count_item_post_detail_no_preview_link)
@ -2353,6 +2456,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -2467,6 +2571,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_gallery) @BindView(R.id.score_text_view_item_post_detail_gallery)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_gallery)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_gallery) @BindView(R.id.minus_button_item_post_detail_gallery)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_gallery) @BindView(R.id.comments_count_item_post_detail_gallery)
@ -2499,6 +2605,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,
@ -2654,6 +2761,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ImageView mUpvoteButton; ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail_text) @BindView(R.id.score_text_view_item_post_detail_text)
TextView mScoreTextView; TextView mScoreTextView;
@BindView(R.id.downvote_text_view_item_post_detail_text)
TextView mDownvoteTextView;
@BindView(R.id.minus_button_item_post_detail_text) @BindView(R.id.minus_button_item_post_detail_text)
ImageView mDownvoteButton; ImageView mDownvoteButton;
@BindView(R.id.comments_count_item_post_detail_text) @BindView(R.id.comments_count_item_post_detail_text)
@ -2685,6 +2795,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mBottomConstraintLayout, mBottomConstraintLayout,
mUpvoteButton, mUpvoteButton,
mScoreTextView, mScoreTextView,
mDownvoteTextView,
mDownvoteButton, mDownvoteButton,
commentsCountTextView, commentsCountTextView,
mSaveButton, mSaveButton,

View File

@ -657,7 +657,7 @@ public class ParsePost {
post.setVoteType(data.getInt("my_vote")); post.setVoteType(data.getInt("my_vote"));
if(post.getVoteType() == 1) if(post.getVoteType() == 1)
post.setUpvotes(post.getUpvotes() - 1); post.setUpvotes(post.getUpvotes() - 1);
else else if(post.getVoteType() == -1)
post.setDownvotes(post.getDownvotes() - 1); post.setDownvotes(post.getDownvotes() - 1);
} }
if (!data.getJSONObject("post").isNull("body")) { if (!data.getJSONObject("post").isNull("body")) {

View File

@ -205,6 +205,7 @@
android:gravity="start" android:gravity="start"
android:textSize="?attr/font_12" android:textSize="?attr/font_12"
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/down_vote_button_item_post_comment" app:layout_constraintStart_toEndOf="@+id/down_vote_button_item_post_comment"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View File

@ -289,6 +289,19 @@
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_gallery" app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_gallery"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_gallery"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:gravity="start"
android:visibility="gone"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_gallery"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_gallery" android:id="@+id/comments_count_item_post_detail_gallery"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -301,7 +314,7 @@
android:textSize="?attr/font_12" android:textSize="?attr/font_12"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_gallery" app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_gallery"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView

View File

@ -294,6 +294,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_image_and_gif_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_image_and_gif_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_image_and_gif_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_image_and_gif_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_image_and_gif_autoplay" android:id="@+id/comments_count_item_post_detail_image_and_gif_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -307,7 +320,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_image_and_gif_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_image_and_gif_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_image_and_gif_autoplay" android:id="@+id/save_button_item_post_detail_image_and_gif_autoplay"

View File

@ -304,6 +304,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_link" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_link" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_link"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_link" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_link" android:id="@+id/comments_count_item_post_detail_link"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -317,7 +330,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_link" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_link" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_link" android:id="@+id/save_button_item_post_detail_link"

View File

@ -271,6 +271,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_no_preview_link" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_no_preview_link" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_no_preview_link"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_no_preview_link" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_no_preview_link" android:id="@+id/comments_count_item_post_detail_no_preview_link"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -284,7 +297,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_no_preview_link" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_no_preview_link" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_no_preview_link" android:id="@+id/save_button_item_post_detail_no_preview_link"

View File

@ -255,6 +255,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_text" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_text" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_text" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_text" android:id="@+id/comments_count_item_post_detail_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -268,7 +281,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_text" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_text" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_text" android:id="@+id/save_button_item_post_detail_text"

View File

@ -307,6 +307,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_and_gif_preview" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_and_gif_preview" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_and_gif_preview" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_video_and_gif_preview" android:id="@+id/comments_count_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -320,7 +333,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_and_gif_preview" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_video_and_gif_preview" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_video_and_gif_preview" android:id="@+id/save_button_item_post_detail_video_and_gif_preview"

View File

@ -288,6 +288,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_video_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_video_autoplay" android:id="@+id/comments_count_item_post_detail_video_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -301,7 +314,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_video_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_video_autoplay" android:id="@+id/save_button_item_post_detail_video_autoplay"

View File

@ -289,6 +289,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_detail_video_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_detail_video_autoplay" android:id="@+id/comments_count_item_post_detail_video_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -302,7 +315,7 @@
android:drawablePadding="12dp" android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_detail_video_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_detail_video_autoplay" android:id="@+id/save_button_item_post_detail_video_autoplay"