Basic up/down vote separation

This commit adds separation option of the up and downvote scres for post on the main page.
This commit is contained in:
Bazsalanszky 2023-08-09 20:39:12 +02:00
parent 167aecb696
commit b13dd58c70
25 changed files with 420 additions and 79 deletions

View File

@ -11,6 +11,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
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;
@ -226,6 +227,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private boolean mHideTheNumberOfAwards; private boolean mHideTheNumberOfAwards;
private boolean mHideSubredditAndUserPrefix; private boolean mHideSubredditAndUserPrefix;
private boolean mHideTheNumberOfVotes; private boolean mHideTheNumberOfVotes;
private boolean mSeparateUpandDownVotes;
private boolean mHideTheNumberOfComments; private boolean mHideTheNumberOfComments;
private boolean mLegacyAutoplayVideoControllerUI; private boolean mLegacyAutoplayVideoControllerUI;
private boolean mFixedHeightPreviewInCard; private boolean mFixedHeightPreviewInCard;
@ -308,6 +311,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false); mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false); mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false); mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true);
mHideTheNumberOfComments = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false); mHideTheNumberOfComments = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false);
mLegacyAutoplayVideoControllerUI = sharedPreferences.getBoolean(SharedPreferencesUtils.LEGACY_AUTOPLAY_VIDEO_CONTROLLER_UI, false); mLegacyAutoplayVideoControllerUI = sharedPreferences.getBoolean(SharedPreferencesUtils.LEGACY_AUTOPLAY_VIDEO_CONTROLLER_UI, false);
mFixedHeightPreviewInCard = sharedPreferences.getBoolean(SharedPreferencesUtils.FIXED_HEIGHT_PREVIEW_IN_CARD, false); mFixedHeightPreviewInCard = sharedPreferences.getBoolean(SharedPreferencesUtils.FIXED_HEIGHT_PREVIEW_IN_CARD, false);
@ -649,7 +653,22 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostBaseViewHolder) holder).titleTextView.setText(post.getTitle()); ((PostBaseViewHolder) holder).titleTextView.setText(post.getTitle());
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if( mSeparateUpandDownVotes ) {
((PostBaseViewHolder) holder).downvoteTextView.setVisibility(View.VISIBLE);
int downVotes = (post.getVoteType() == -1) ? post.getDownvotes()+1 : post.getDownvotes();
int upVotes = (post.getVoteType() == 1) ? post.getUpvotes()+1 : post.getUpvotes();
((PostBaseViewHolder) holder).downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,downVotes));
((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upVotes));
((PostBaseViewHolder) holder).downvoteTextView.setGravity(Gravity.START);
((PostBaseViewHolder) holder).scoreTextView.setGravity(Gravity.START);
((PostBaseViewHolder) holder).scoreTextView.getLayoutParams().width = (int) (32 * mActivity.getResources().getDisplayMetrics().density);
((PostBaseViewHolder) holder).scoreTextView.setPadding(0, 0, 6, 0);
((PostBaseViewHolder) holder).downvoteButton.setPadding(24, 0, 12, 0);
((PostBaseViewHolder) holder).upvoteButton.setPadding(24, 0, 12, 0);
} else {
((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
} else { } else {
((PostBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote)); ((PostBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
} }
@ -671,8 +690,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
case -1: case -1:
//Downvoted //Downvoted
((PostBaseViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((PostBaseViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes){
((PostBaseViewHolder) holder).downvoteTextView.setTextColor(mDownvotedColor);
} else {
((PostBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((PostBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
}
break; break;
case 0:
((PostBaseViewHolder) holder).downvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) { if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
@ -1248,7 +1273,24 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).titleTextView.setText(title); ((PostCompactBaseViewHolder) holder).titleTextView.setText(title);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if(mSeparateUpandDownVotes){
int upvotes = (post.getVoteType() == 1) ? post.getUpvotes()+1 : post.getUpvotes();
int downvotes = (post.getVoteType() == -1) ? post.getDownvotes()+1 : post.getDownvotes();
((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
((PostCompactBaseViewHolder) holder).downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
((PostCompactBaseViewHolder) holder).downvoteTextView.setVisibility(View.VISIBLE);
((PostCompactBaseViewHolder) holder).downvoteTextView.setGravity(Gravity.START);
((PostCompactBaseViewHolder) holder).scoreTextView.setGravity(Gravity.START);
((PostCompactBaseViewHolder) holder).scoreTextView.getLayoutParams().width = (int) (32 * mActivity.getResources().getDisplayMetrics().density);
((PostCompactBaseViewHolder) holder).scoreTextView.setPadding(0, 0, 6, 0);
((PostCompactBaseViewHolder) holder).downvoteButton.setPadding(24, 0, 12, 0);
((PostCompactBaseViewHolder) holder).upvoteButton.setPadding(24, 0, 12, 0);
} else {
((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
} else { } else {
((PostCompactBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote)); ((PostCompactBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
} }
@ -1270,7 +1312,11 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
case -1: case -1:
//Downvoted //Downvoted
((PostCompactBaseViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((PostCompactBaseViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes){
((PostCompactBaseViewHolder) holder).downvoteTextView.setTextColor(mDownvotedColor);
} else {
((PostCompactBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((PostCompactBaseViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
}
break; break;
} }
@ -2312,6 +2358,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ConstraintLayout bottomConstraintLayout; ConstraintLayout bottomConstraintLayout;
ImageView upvoteButton; ImageView upvoteButton;
TextView scoreTextView; TextView scoreTextView;
TextView downvoteTextView;
ImageView downvoteButton; ImageView downvoteButton;
TextView commentsCountTextView; TextView commentsCountTextView;
ImageView saveButton; ImageView saveButton;
@ -2343,6 +2391,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ConstraintLayout bottomConstraintLayout, ConstraintLayout bottomConstraintLayout,
ImageView upvoteButton, ImageView upvoteButton,
TextView scoreTextView, TextView scoreTextView,
TextView downvoteTextView,
ImageView downvoteButton, ImageView downvoteButton,
TextView commentsCountTextView, TextView commentsCountTextView,
ImageView saveButton, ImageView saveButton,
@ -2364,6 +2413,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
this.bottomConstraintLayout = bottomConstraintLayout; this.bottomConstraintLayout = bottomConstraintLayout;
this.upvoteButton = upvoteButton; this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView; this.scoreTextView = scoreTextView;
this.downvoteTextView = downvoteTextView;
this.downvoteButton = downvoteButton; this.downvoteButton = downvoteButton;
this.commentsCountTextView = commentsCountTextView; this.commentsCountTextView = commentsCountTextView;
this.saveButton = saveButton; this.saveButton = saveButton;
@ -2689,18 +2739,32 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE);
downvoteButton downvoteButton
.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes) {
scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteTextView.setTextColor(mDownvotedColor);
}else {
scoreTextView.setTextColor(mDownvotedColor); scoreTextView.setTextColor(mDownvotedColor);
}
} else { } else {
//Downvoted before //Downvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE);
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mPostIconAndInfoColor); scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if(mSeparateUpandDownVotes){
if(post.getVoteType() == -1)
downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getDownvotes() + 1 ));
else if (post.getVoteType() == 1){
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getUpvotes() + 1));
}
}else {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
} }
}
VoteThing.votePost(mActivity, retrofit, mAccessToken, new VoteThing.VoteThingListener() { VoteThing.votePost(mActivity, retrofit, mAccessToken, new VoteThing.VoteThingListener() {
@Override @Override
@ -2710,12 +2774,17 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
post.setVoteType(-1); post.setVoteType(-1);
if (currentPosition == position) { if (currentPosition == position) {
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes){
downvoteTextView.setTextColor(mDownvotedColor);
}else {
scoreTextView.setTextColor(mDownvotedColor); scoreTextView.setTextColor(mDownvotedColor);
} }
}
} else { } else {
post.setVoteType(0); post.setVoteType(0);
if (currentPosition == position) { if (currentPosition == position) {
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
downvoteTextView.setTextColor(mPostIconAndInfoColor);
scoreTextView.setTextColor(mPostIconAndInfoColor); scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
} }
@ -2723,9 +2792,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
if (currentPosition == position) { if (currentPosition == position) {
upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if(mSeparateUpandDownVotes){
int downvotes = (post.getVoteType() == -1) ? post.getDownvotes() + 1 : post.getDownvotes();
downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
} }
} }
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post)); EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
} }
@ -2855,6 +2929,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ConstraintLayout bottomConstraintLayout, ConstraintLayout bottomConstraintLayout,
ImageView upvoteButton, ImageView upvoteButton,
TextView scoreTextView, TextView scoreTextView,
TextView downvoteTextView,
ImageView downvoteButton, ImageView downvoteButton,
TextView commentsCountTextView, TextView commentsCountTextView,
ImageView saveButton, ImageView saveButton,
@ -2864,7 +2939,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
setBaseView(iconGifImageView, subredditTextView, userTextView, stickiedPostImageView, postTimeTextView, setBaseView(iconGifImageView, subredditTextView, userTextView, stickiedPostImageView, postTimeTextView,
titleTextView, typeTextView, archivedImageView, lockedImageView, crosspostImageView, titleTextView, typeTextView, archivedImageView, lockedImageView, crosspostImageView,
nsfwTextView, spoilerTextView, flairTextView, awardsTextView, bottomConstraintLayout, nsfwTextView, spoilerTextView, flairTextView, awardsTextView, bottomConstraintLayout,
upvoteButton, scoreTextView, downvoteButton, commentsCountTextView, saveButton, shareButton); upvoteButton, scoreTextView, downvoteTextView,downvoteButton, commentsCountTextView, saveButton, shareButton);
} }
void markPostRead(Post post, boolean changePostItemColor) { void markPostRead(Post post, boolean changePostItemColor) {
@ -2942,6 +3017,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_video_type_autoplay) @BindView(R.id.score_text_view_item_post_video_type_autoplay)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_video_type_autoplay)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_video_type_autoplay) @BindView(R.id.minus_button_item_post_video_type_autoplay)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_video_type_autoplay) @BindView(R.id.comments_count_item_post_video_type_autoplay)
@ -2981,6 +3059,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -3257,6 +3336,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_with_preview) @BindView(R.id.score_text_view_item_post_with_preview)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_with_preview)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_with_preview) @BindView(R.id.minus_button_item_post_with_preview)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_with_preview) @BindView(R.id.comments_count_item_post_with_preview)
@ -3288,6 +3370,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -3376,6 +3459,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ConstraintLayout bottomConstraintLayout, ConstraintLayout bottomConstraintLayout,
ImageView upvoteButton, ImageView upvoteButton,
TextView scoreTextView, TextView scoreTextView,
TextView downvoteTextView,
ImageView downvoteButton, ImageView downvoteButton,
TextView commentsCountTextView, TextView commentsCountTextView,
ImageView saveButton, ImageView saveButton,
@ -3400,6 +3484,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -3554,6 +3639,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
binding.bottomConstraintLayoutItemPostGalleryType, binding.bottomConstraintLayoutItemPostGalleryType,
binding.upvoteButtonItemPostGalleryType, binding.upvoteButtonItemPostGalleryType,
binding.scoreTextViewItemPostGalleryType, binding.scoreTextViewItemPostGalleryType,
binding.downvoteTextViewItemPostGalleryType,
binding.downvoteButtonItemPostGalleryType, binding.downvoteButtonItemPostGalleryType,
binding.commentsCountTextViewItemPostGalleryType, binding.commentsCountTextViewItemPostGalleryType,
binding.saveButtonItemPostGalleryType, binding.saveButtonItemPostGalleryType,
@ -3599,6 +3685,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_text_type) @BindView(R.id.score_text_view_item_post_text_type)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_text_type)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_text_type) @BindView(R.id.minus_button_item_post_text_type)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_text_type) @BindView(R.id.comments_count_item_post_text_type)
@ -3629,6 +3719,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -3667,6 +3758,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ConstraintLayout bottomConstraintLayout; ConstraintLayout bottomConstraintLayout;
ImageView upvoteButton; ImageView upvoteButton;
TextView scoreTextView; TextView scoreTextView;
TextView downvoteTextView;
ImageView downvoteButton; ImageView downvoteButton;
TextView commentsCountTextView; TextView commentsCountTextView;
ImageView saveButton; ImageView saveButton;
@ -3694,7 +3786,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
FrameLayout noPreviewLinkImageFrameLayout, FrameLayout noPreviewLinkImageFrameLayout,
ImageView noPreviewLinkImageView, Barrier imageBarrier, ImageView noPreviewLinkImageView, Barrier imageBarrier,
ConstraintLayout bottomConstraintLayout, ImageView upvoteButton, ConstraintLayout bottomConstraintLayout, ImageView upvoteButton,
TextView scoreTextView, ImageView downvoteButton, TextView scoreTextView, TextView downvoteTextView, ImageView downvoteButton,
TextView commentsCountTextView, ImageView saveButton, TextView commentsCountTextView, ImageView saveButton,
ImageView shareButton, View divider) { ImageView shareButton, View divider) {
this.iconGifImageView = iconGifImageView; this.iconGifImageView = iconGifImageView;
@ -3722,6 +3814,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
this.bottomConstraintLayout = bottomConstraintLayout; this.bottomConstraintLayout = bottomConstraintLayout;
this.upvoteButton = upvoteButton; this.upvoteButton = upvoteButton;
this.scoreTextView = scoreTextView; this.scoreTextView = scoreTextView;
this.downvoteTextView = downvoteTextView;
this.downvoteButton = downvoteButton; this.downvoteButton = downvoteButton;
this.commentsCountTextView = commentsCountTextView; this.commentsCountTextView = commentsCountTextView;
this.saveButton = saveButton; this.saveButton = saveButton;
@ -4052,18 +4145,28 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_DOWNVOTE);
downvoteButton downvoteButton
.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes){
downvoteTextView.setTextColor(mDownvotedColor);
}else {
scoreTextView.setTextColor(mDownvotedColor); scoreTextView.setTextColor(mDownvotedColor);
}
} else { } else {
//Downvoted before //Downvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE); newVoteType = Integer.parseInt(APIUtils.DIR_UNVOTE);
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mPostIconAndInfoColor); scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if(mSeparateUpandDownVotes) {
int downvotes = (post.getVoteType() == -1) ? post.getDownvotes() +1 : post.getDownvotes();
downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
} }
}
VoteThing.votePost(mActivity, retrofit, mAccessToken, new VoteThing.VoteThingListener() { VoteThing.votePost(mActivity, retrofit, mAccessToken, new VoteThing.VoteThingListener() {
@Override @Override
@ -4073,23 +4176,33 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
post.setVoteType(-1); post.setVoteType(-1);
if (currentPosition == position) { if (currentPosition == position) {
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
if(mSeparateUpandDownVotes) {
downvoteTextView.setTextColor(mDownvotedColor);
} else {
scoreTextView.setTextColor(mDownvotedColor); scoreTextView.setTextColor(mDownvotedColor);
} }
}
} else { } else {
post.setVoteType(0); post.setVoteType(0);
if (currentPosition == position) { if (currentPosition == position) {
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mPostIconAndInfoColor); scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteTextView.setTextColor(mPostIconAndInfoColor);
} }
} }
if (currentPosition == position) { if (currentPosition == position) {
upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (!mHideTheNumberOfVotes) { if (!mHideTheNumberOfVotes) {
if(mSeparateUpandDownVotes) {
int downvotes = (post.getVoteType() == -1) ? post.getDownvotes() +1 : post.getDownvotes();
downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
} else {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
} }
} }
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post)); EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
} }
@ -4283,6 +4396,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_compact) @BindView(R.id.score_text_view_item_post_compact)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_compact)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_compact) @BindView(R.id.minus_button_item_post_compact)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_compact) @BindView(R.id.comments_count_item_post_compact)
@ -4303,7 +4419,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
lockedImageView, crosspostImageView, nsfwTextView, spoilerTextView, lockedImageView, crosspostImageView, nsfwTextView, spoilerTextView,
flairTextView, awardsTextView, linkTextView, relativeLayout, progressBar, imageView, flairTextView, awardsTextView, linkTextView, relativeLayout, progressBar, imageView,
playButtonImageView, noPreviewLinkImageFrameLayout, noPreviewLinkImageView, playButtonImageView, noPreviewLinkImageFrameLayout, noPreviewLinkImageView,
imageBarrier, bottomConstraintLayout, upvoteButton, scoreTextView, downvoteButton, imageBarrier, bottomConstraintLayout, upvoteButton, scoreTextView, downvoteTextView,downvoteButton,
commentsCountTextView, saveButton, shareButton, divider); commentsCountTextView, saveButton, shareButton, divider);
} }
} }
@ -4359,6 +4475,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_compact_right_thumbnail) @BindView(R.id.score_text_view_item_post_compact_right_thumbnail)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_compact_right_thumbnail)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_compact_right_thumbnail) @BindView(R.id.minus_button_item_post_compact_right_thumbnail)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_compact_right_thumbnail) @BindView(R.id.comments_count_item_post_compact_right_thumbnail)
@ -4379,7 +4498,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
lockedImageView, crosspostImageView, nsfwTextView, spoilerTextView, lockedImageView, crosspostImageView, nsfwTextView, spoilerTextView,
flairTextView, awardsTextView, linkTextView, relativeLayout, progressBar, imageView, flairTextView, awardsTextView, linkTextView, relativeLayout, progressBar, imageView,
playButtonImageView, noPreviewLinkImageFrameLayout, noPreviewLinkImageView, playButtonImageView, noPreviewLinkImageFrameLayout, noPreviewLinkImageView,
imageBarrier, bottomConstraintLayout, upvoteButton, scoreTextView, downvoteButton, imageBarrier, bottomConstraintLayout, upvoteButton, scoreTextView,downvoteTextView, downvoteButton,
commentsCountTextView, saveButton, shareButton, divider); commentsCountTextView, saveButton, shareButton, divider);
} }
} }
@ -4747,6 +4866,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_card_2_video_autoplay) @BindView(R.id.score_text_view_item_post_card_2_video_autoplay)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_card_2_video_autoplay)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_card_2_video_autoplay) @BindView(R.id.minus_button_item_post_card_2_video_autoplay)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_card_2_video_autoplay) @BindView(R.id.comments_count_item_post_card_2_video_autoplay)
@ -4788,6 +4911,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -5062,6 +5186,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_card_2_with_preview) @BindView(R.id.score_text_view_item_post_card_2_with_preview)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_card_2_with_preview)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_card_2_with_preview) @BindView(R.id.minus_button_item_post_card_2_with_preview)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_card_2_with_preview) @BindView(R.id.comments_count_item_post_card_2_with_preview)
@ -5095,6 +5222,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,
@ -5179,6 +5307,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
binding.bottomConstraintLayoutItemPostCard2GalleryType, binding.bottomConstraintLayoutItemPostCard2GalleryType,
binding.upvoteButtonItemPostCard2GalleryType, binding.upvoteButtonItemPostCard2GalleryType,
binding.scoreTextViewItemPostCard2GalleryType, binding.scoreTextViewItemPostCard2GalleryType,
binding.downvoteTextViewItemPostCard2GalleryType,
binding.downvoteButtonItemPostCard2GalleryType, binding.downvoteButtonItemPostCard2GalleryType,
binding.commentsCountTextViewItemPostCard2GalleryType, binding.commentsCountTextViewItemPostCard2GalleryType,
binding.saveButtonItemPostCard2GalleryType, binding.saveButtonItemPostCard2GalleryType,
@ -5226,6 +5355,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ImageView upvoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_card_2_text) @BindView(R.id.score_text_view_item_post_card_2_text)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.downvote_text_view_item_post_card_2_text)
TextView downvoteTextView;
@BindView(R.id.minus_button_item_post_card_2_text) @BindView(R.id.minus_button_item_post_card_2_text)
ImageView downvoteButton; ImageView downvoteButton;
@BindView(R.id.comments_count_item_post_card_2_text) @BindView(R.id.comments_count_item_post_card_2_text)
@ -5258,6 +5390,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
bottomConstraintLayout, bottomConstraintLayout,
upvoteButton, upvoteButton,
scoreTextView, scoreTextView,
downvoteTextView,
downvoteButton, downvoteButton,
commentsCountTextView, commentsCountTextView,
saveButton, saveButton,

View File

@ -41,7 +41,8 @@ public class Comment implements Parcelable {
private String communityQualifiedName; private String communityQualifiedName;
private Integer parentId; private Integer parentId;
private int score; private int downvotes;
private int upvotes;
private int voteType; private int voteType;
private boolean isSubmitter; private boolean isSubmitter;
private String distinguished; private String distinguished;
@ -67,7 +68,7 @@ public class Comment implements Parcelable {
public Comment(int id, int postId, String fullName, String author, String authorQualifiedName, String linkAuthor, public Comment(int id, int postId, String fullName, String author, String authorQualifiedName, String linkAuthor,
long commentTimeMillis, String commentMarkdown, String commentRawText, long commentTimeMillis, String commentMarkdown, String commentRawText,
String linkId, String communityName, String communityQualifiedName, Integer parentId, int score, String linkId, String communityName, String communityQualifiedName, Integer parentId, int downvotes,int upvotes,
int voteType, boolean isSubmitter, String distinguished, String permalink, int voteType, boolean isSubmitter, String distinguished, String permalink,
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) { int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) {
this.id = id; this.id = id;
@ -83,7 +84,8 @@ public class Comment implements Parcelable {
this.communityName = communityName; this.communityName = communityName;
this.communityQualifiedName = communityQualifiedName; this.communityQualifiedName = communityQualifiedName;
this.parentId = parentId; this.parentId = parentId;
this.score = score; this.downvotes = downvotes;
this.upvotes = upvotes;
this.voteType = voteType; this.voteType = voteType;
this.isSubmitter = isSubmitter; this.isSubmitter = isSubmitter;
this.distinguished = distinguished; this.distinguished = distinguished;
@ -132,7 +134,8 @@ public class Comment implements Parcelable {
communityName = in.readString(); communityName = in.readString();
communityQualifiedName = in.readString(); communityQualifiedName = in.readString();
parentId = in.readInt(); parentId = in.readInt();
score = in.readInt(); downvotes = in.readInt();
upvotes = in.readInt();
voteType = in.readInt(); voteType = in.readInt();
isSubmitter = in.readByte() != 0; isSubmitter = in.readByte() != 0;
distinguished = in.readString(); distinguished = in.readString();
@ -228,11 +231,7 @@ public class Comment implements Parcelable {
} }
public int getScore() { public int getScore() {
return score; return upvotes-downvotes;
}
public void setScore(int score) {
this.score = score;
} }
public boolean isSubmitter() { public boolean isSubmitter() {
@ -432,7 +431,8 @@ public class Comment implements Parcelable {
parcel.writeString(communityName); parcel.writeString(communityName);
parcel.writeString(communityQualifiedName); parcel.writeString(communityQualifiedName);
parcel.writeInt(parentId == null ? 0 : parentId); parcel.writeInt(parentId == null ? 0 : parentId);
parcel.writeInt(score); parcel.writeInt(downvotes);
parcel.writeInt(upvotes);
parcel.writeInt(voteType); parcel.writeInt(voteType);
parcel.writeByte((byte) (isSubmitter ? 1 : 0)); parcel.writeByte((byte) (isSubmitter ? 1 : 0));
parcel.writeString(distinguished); parcel.writeString(distinguished);

View File

@ -316,10 +316,16 @@ public class ParseComment {
String communityName = communityObj.getString("name"); String communityName = communityObj.getString("name");
String communityQualifiedName = LemmyUtils.actorID2FullName(communityObj.getString("actor_id")); String communityQualifiedName = LemmyUtils.actorID2FullName(communityObj.getString("actor_id"));
int score = countsObj.getInt("score"); int upvotes = countsObj.getInt("upvotes");
int downvotes = countsObj.getInt("downvotes");
int voteType = (jsonObject.isNull("my_vote")) ? 0 : jsonObject.getInt("my_vote"); int voteType = (jsonObject.isNull("my_vote")) ? 0 : jsonObject.getInt("my_vote");
if (voteType != 0) if (voteType != 0) {
score -= 1; if(voteType == 1) {
upvotes--;
} else {
downvotes--;
}
}
boolean isSubmitter = creatorObj.getInt("id") == postObj.getInt("creator_id"); boolean isSubmitter = creatorObj.getInt("id") == postObj.getInt("creator_id");
String distinguished = commentObj.getString("distinguished"); String distinguished = commentObj.getString("distinguished");
String permalink = commentObj.getString("ap_id"); String permalink = commentObj.getString("ap_id");
@ -337,7 +343,7 @@ public class ParseComment {
Comment comment = new Comment(id, postID, fullName, author, authorQualifiedName, linkAuthor, commentTimeMillis, Comment comment = new Comment(id, postID, fullName, author, authorQualifiedName, linkAuthor, commentTimeMillis,
commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId, commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId,
score, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path); downvotes,upvotes, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path);
int child_count = countsObj.getInt("child_count"); int child_count = countsObj.getInt("child_count");
comment.setChildCount(child_count); comment.setChildCount(child_count);
comment.setAuthorIconUrl(authorAvatar); comment.setAuthorIconUrl(authorAvatar);

View File

@ -1033,7 +1033,8 @@ public class HistoryPostFragment extends Fragment implements FragmentCommunicato
if (post != null && post.getFullName().equals(event.post.getFullName())) { if (post != null && post.getFullName().equals(event.post.getFullName())) {
post.setTitle(event.post.getTitle()); post.setTitle(event.post.getTitle());
post.setVoteType(event.post.getVoteType()); post.setVoteType(event.post.getVoteType());
post.setScore(event.post.getScore()); post.setDownvotes(event.post.getDownvotes());
post.setUpvotes(event.post.getUpvotes());
post.setNComments(event.post.getNComments()); post.setNComments(event.post.getNComments());
post.setNSFW(event.post.isNSFW()); post.setNSFW(event.post.isNSFW());
post.setHidden(event.post.isHidden()); post.setHidden(event.post.isHidden());

View File

@ -1781,7 +1781,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if (post != null && post.getFullName().equals(event.post.getFullName())) { if (post != null && post.getFullName().equals(event.post.getFullName())) {
post.setTitle(event.post.getTitle()); post.setTitle(event.post.getTitle());
post.setVoteType(event.post.getVoteType()); post.setVoteType(event.post.getVoteType());
post.setScore(event.post.getScore()); post.setDownvotes(event.post.getDownvotes());
post.setUpvotes(event.post.getUpvotes());
post.setNComments(event.post.getNComments()); post.setNComments(event.post.getNComments());
post.setNSFW(event.post.isNSFW()); post.setNSFW(event.post.isNSFW());
post.setHidden(event.post.isHidden()); post.setHidden(event.post.isHidden());

View File

@ -1440,7 +1440,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
isLoadingMoreChildren = true; isLoadingMoreChildren = true;
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken,
mPost.getId(), mSingleCommentId == null ? null : mSingleCommentParentId == null || mSingleCommentParentId == 0 ? mSingleCommentId : mSingleCommentParentId, sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() { mPost.getId(), (mSingleCommentId == null || mSingleCommentId == 0) ? null : (mSingleCommentParentId == null || mSingleCommentParentId == 0 ? mSingleCommentId : mSingleCommentParentId), sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() {
@Override @Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) { public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) {
pages_loaded++; pages_loaded++;

View File

@ -178,6 +178,8 @@ public class ParsePost {
String title = post.getString("name"); String title = post.getString("name");
String permalink = post.getString("ap_id"); String permalink = post.getString("ap_id");
int score = counts.getInt("score"); int score = counts.getInt("score");
int upvotes = counts.getInt("upvotes");
int downvotes = counts.getInt("downvotes");
int voteType = 0; int voteType = 0;
int nComments = counts.getInt("comments"); int nComments = counts.getInt("comments");
int upvoteRatio = 100 * counts.getInt("upvotes") / max(counts.getInt("upvotes") + counts.getInt("downvotes"), 1); int upvoteRatio = 100 * counts.getInt("upvotes") / max(counts.getInt("upvotes") + counts.getInt("downvotes"), 1);
@ -197,7 +199,7 @@ public class ParsePost {
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed, return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
author,authorFull, postTimeMillis, title, previews, author,authorFull, postTimeMillis, title, previews,
score, voteType, nComments, upvoteRatio, nsfw, locked, saved, downvotes,upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
} }
@ -205,7 +207,7 @@ public class ParsePost {
private static Post parseData(JSONObject data, String permalink, int id, String fullName, private static Post parseData(JSONObject data, String permalink, int id, String fullName,
String subredditName, String subredditNamePrefixed, String author, String authorFull, String subredditName, String subredditNamePrefixed, String author, String authorFull,
long postTimeMillis, String title, ArrayList<Post.Preview> previews, long postTimeMillis, String title, ArrayList<Post.Preview> previews,
int score, int voteType, int nComments, int upvoteRatio, int downvotes,int upvotes, int voteType, int nComments, int upvoteRatio,
boolean nsfw, boolean locked, boolean nsfw, boolean locked,
boolean saved, boolean saved,
String distinguished, String suggestedSort) throws JSONException { String distinguished, String suggestedSort) throws JSONException {
@ -225,7 +227,7 @@ public class ParsePost {
//Text post //Text post
int postType = Post.TEXT_TYPE; int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, permalink, score, postTimeMillis, title, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, postType, voteType, nComments, upvoteRatio, nsfw,
locked, saved, distinguished, suggestedSort); locked, saved, distinguished, suggestedSort);
String body = data.getJSONObject("post").getString("body"); String body = data.getJSONObject("post").getString("body");
@ -238,7 +240,7 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE; int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
if (previews.isEmpty()) { if (previews.isEmpty()) {
@ -250,7 +252,7 @@ public class ParsePost {
//No preview video post //No preview video post
int postType = Post.VIDEO_TYPE; int postType = Post.VIDEO_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, score, postType, voteType, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, downvotes,upvotes, postType, voteType,
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
post.setVideoUrl(url); post.setVideoUrl(url);
@ -259,7 +261,7 @@ public class ParsePost {
//No preview link post //No preview link post
int postType = Post.NO_PREVIEW_LINK_TYPE; int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) { if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText(""); post.setSelfText("");
@ -293,7 +295,7 @@ public class ParsePost {
} else { } else {
int postType = Post.TEXT_TYPE; int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, permalink, score, postTimeMillis, title, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, postType, voteType, nComments, upvoteRatio, nsfw,
locked, saved, distinguished, suggestedSort); locked, saved, distinguished, suggestedSort);
String body = ""; String body = "";
@ -331,7 +333,7 @@ public class ParsePost {
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString(); String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY); String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, score, postType, voteType, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
post.setPreviews(previews); post.setPreviews(previews);
@ -343,7 +345,7 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE; int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
authorFull, postTimeMillis, title, url, permalink, score, authorFull, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
@ -355,7 +357,7 @@ public class ParsePost {
//Gif post //Gif post
int postType = Post.GIF_TYPE; int postType = Post.GIF_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, postType, voteType, nComments, upvoteRatio,
nsfw, locked, saved, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
@ -371,7 +373,7 @@ public class ParsePost {
} }
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, postType, voteType, nComments, upvoteRatio,
nsfw, locked, saved, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
@ -384,7 +386,7 @@ public class ParsePost {
int postType = Post.VIDEO_TYPE; int postType = Post.VIDEO_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
post.setPreviews(previews); post.setPreviews(previews);
@ -395,7 +397,7 @@ public class ParsePost {
int postType = Post.LINK_TYPE; int postType = Post.LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
distinguished, suggestedSort); distinguished, suggestedSort);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) { if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
@ -436,7 +438,7 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE; int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
if (previews.isEmpty()) { if (previews.isEmpty()) {
@ -448,7 +450,7 @@ public class ParsePost {
int postType = Post.VIDEO_TYPE; int postType = Post.VIDEO_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
post.setPreviews(previews); post.setPreviews(previews);
post.setVideoUrl(url); post.setVideoUrl(url);
@ -458,7 +460,7 @@ public class ParsePost {
int postType = Post.NO_PREVIEW_LINK_TYPE; int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull, post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
postTimeMillis, title, url, permalink, score, postTimeMillis, title, url, permalink, downvotes, upvotes,
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort); postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
//Need attention //Need attention
if (data.isNull(JSONUtils.SELFTEXT_KEY)) { if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
@ -653,7 +655,10 @@ public class ParsePost {
} }
if (!data.isNull("my_vote")) { if (!data.isNull("my_vote")) {
post.setVoteType(data.getInt("my_vote")); post.setVoteType(data.getInt("my_vote"));
post.setScore(post.getScore() - 1); if(post.getVoteType() == 1)
post.setUpvotes(post.getUpvotes() - 1);
else
post.setDownvotes(post.getDownvotes() - 1);
} }
if (!data.getJSONObject("post").isNull("body")) { if (!data.getJSONObject("post").isNull("body")) {
String body = data.getJSONObject("post").getString("body"); String body = data.getJSONObject("post").getString("body");

View File

@ -56,7 +56,10 @@ public class Post implements Parcelable {
private boolean loadGfyOrStreamableVideoSuccess; private boolean loadGfyOrStreamableVideoSuccess;
private String permalink; private String permalink;
private long postTimeMillis; private long postTimeMillis;
private int score;
private int downvotes;
private int upvotes;
private int postType; private int postType;
private int voteType; private int voteType;
private int nComments; private int nComments;
@ -77,7 +80,7 @@ public class Post implements Parcelable {
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed, public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
String author,String authorNamePrefixed, long postTimeMillis, String author,String authorNamePrefixed, long postTimeMillis,
String title, String permalink, int score, int postType, int voteType, int nComments, String title, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
int upvoteRatio, int upvoteRatio,
boolean nsfw, boolean locked, boolean saved, boolean nsfw, boolean locked, boolean saved,
String distinguished, String suggestedSort) { String distinguished, String suggestedSort) {
@ -90,7 +93,8 @@ public class Post implements Parcelable {
this.postTimeMillis = postTimeMillis; this.postTimeMillis = postTimeMillis;
this.title = title; this.title = title;
this.permalink = permalink; this.permalink = permalink;
this.score = score; this.upvotes = upvotes;
this.downvotes = downvotes;
this.postType = postType; this.postType = postType;
this.voteType = voteType; this.voteType = voteType;
this.nComments = nComments; this.nComments = nComments;
@ -109,7 +113,7 @@ public class Post implements Parcelable {
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed, public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
String author, String authorNamePrefixed, long postTimeMillis, String title, String author, String authorNamePrefixed, long postTimeMillis, String title,
String url, String permalink, int score, int postType, int voteType, int nComments, String url, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
int upvoteRatio, int upvoteRatio,
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) { boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
this.id = id; this.id = id;
@ -122,7 +126,8 @@ public class Post implements Parcelable {
this.title = title; this.title = title;
this.url = url; this.url = url;
this.permalink = permalink; this.permalink = permalink;
this.score = score; this.downvotes = downvotes;
this.upvotes = upvotes;
this.postType = postType; this.postType = postType;
this.voteType = voteType; this.voteType = voteType;
this.nComments = nComments; this.nComments = nComments;
@ -164,7 +169,8 @@ public class Post implements Parcelable {
isStreamable = in.readByte() != 0; isStreamable = in.readByte() != 0;
loadGfyOrStreamableVideoSuccess = in.readByte() != 0; loadGfyOrStreamableVideoSuccess = in.readByte() != 0;
permalink = in.readString(); permalink = in.readString();
score = in.readInt(); downvotes = in.readInt();
upvotes = in.readInt();
postType = in.readInt(); postType = in.readInt();
voteType = in.readInt(); voteType = in.readInt();
nComments = in.readInt(); nComments = in.readInt();
@ -269,6 +275,22 @@ public class Post implements Parcelable {
this.selfTextPlainTrimmed = selfTextPlainTrimmed; this.selfTextPlainTrimmed = selfTextPlainTrimmed;
} }
public int getDownvotes() {
return downvotes;
}
public void setDownvotes(int downvotes) {
this.downvotes = downvotes;
}
public int getUpvotes() {
return upvotes;
}
public void setUpvotes(int upvotes) {
this.upvotes = upvotes;
}
public String getUrl() { public String getUrl() {
return url; return url;
} }
@ -366,11 +388,7 @@ public class Post implements Parcelable {
} }
public int getScore() { public int getScore() {
return score; return upvotes- downvotes;
}
public void setScore(int score) {
this.score = score;
} }
public int getPostType() { public int getPostType() {
@ -508,7 +526,8 @@ public class Post implements Parcelable {
parcel.writeByte((byte) (isStreamable ? 1 : 0)); parcel.writeByte((byte) (isStreamable ? 1 : 0));
parcel.writeByte((byte) (loadGfyOrStreamableVideoSuccess ? 1 : 0)); parcel.writeByte((byte) (loadGfyOrStreamableVideoSuccess ? 1 : 0));
parcel.writeString(permalink); parcel.writeString(permalink);
parcel.writeInt(score); parcel.writeInt(downvotes);
parcel.writeInt(upvotes);
parcel.writeInt(postType); parcel.writeInt(postType);
parcel.writeInt(voteType); parcel.writeInt(voteType);
parcel.writeInt(nComments); parcel.writeInt(nComments);

View File

@ -48,6 +48,12 @@ public class SharedPreferencesUtils {
public static final String USE_CIRCULAR_FAB = "use_circular_fab"; public static final String USE_CIRCULAR_FAB = "use_circular_fab";
public static final String POST_SEPARATE_UP_AND_DOWN_VOTES = "post_separate_down_and_up_votes";
public static final String POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES = "post_detail_separate_down_and_up_votes";
public static final String COMMENT_SEPARATE_UP_AND_DOWN_VOTES = "comment_separate_down_and_up_votes";
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type"; public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post"; public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
public static final String SORT_TIME_BEST_POST = "sort_time_best_post"; public static final String SORT_TIME_BEST_POST = "sort_time_best_post";

View File

@ -256,6 +256,20 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_gallery_type" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_gallery_type" />
<TextView
android:id="@+id/downvote_text_view_item_post_card_2_gallery_type"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/downvote_button_item_post_card_2_gallery_type"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/comments_count_text_view_item_post_card_2_gallery_type" android:id="@+id/comments_count_text_view_item_post_card_2_gallery_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -269,7 +283,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/downvote_button_item_post_card_2_gallery_type" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_card_2_gallery_type" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_card_2_gallery_type" android:id="@+id/save_button_item_post_card_2_gallery_type"

View File

@ -216,6 +216,20 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_text" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_text" />
<TextView
android:id="@+id/downvote_text_view_item_post_card_2_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_card_2_text" />
<TextView <TextView
android:id="@+id/comments_count_item_post_card_2_text" android:id="@+id/comments_count_item_post_card_2_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -229,7 +243,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_card_2_text" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_card_2_text" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_card_2_text" android:id="@+id/save_button_item_post_card_2_text"

View File

@ -257,6 +257,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_video_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_card_2_video_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
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_card_2_video_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_card_2_video_autoplay" android:id="@+id/comments_count_item_post_card_2_video_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -270,7 +283,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_card_2_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_card_2_video_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_card_2_video_autoplay" android:id="@+id/save_button_item_post_card_2_video_autoplay"

View File

@ -257,6 +257,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_video_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_card_2_video_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_card_2_video_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_card_2_video_autoplay" android:id="@+id/comments_count_item_post_card_2_video_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -270,7 +283,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_card_2_video_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_card_2_video_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_card_2_video_autoplay" android:id="@+id/save_button_item_post_card_2_video_autoplay"

View File

@ -268,6 +268,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_with_preview" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_card_2_with_preview" />
<TextView
android:id="@+id/downvote_text_view_item_post_card_2_with_preview"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_card_2_with_preview" />
<TextView <TextView
android:id="@+id/comments_count_item_post_card_2_with_preview" android:id="@+id/comments_count_item_post_card_2_with_preview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -281,7 +294,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_card_2_with_preview" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_card_2_with_preview" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_card_2_with_preview" android:id="@+id/save_button_item_post_card_2_with_preview"

View File

@ -328,6 +328,20 @@
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact" app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/downvote_text_view_item_post_compact"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/comments_count_item_post_compact" android:id="@+id/comments_count_item_post_compact"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -343,7 +357,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_compact" app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_compact"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView

View File

@ -325,6 +325,19 @@
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact_right_thumbnail" app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact_right_thumbnail"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/downvote_text_view_item_post_compact_right_thumbnail"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_compact_right_thumbnail"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/comments_count_item_post_compact_right_thumbnail" android:id="@+id/comments_count_item_post_compact_right_thumbnail"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -340,7 +353,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_compact_right_thumbnail" app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_compact_right_thumbnail"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView

View File

@ -273,6 +273,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_gallery_type" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_gallery_type" />
<TextView
android:id="@+id/downvote_text_view_item_post_gallery_type"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/downvote_button_item_post_gallery_type" />
<TextView <TextView
android:id="@+id/comments_count_text_view_item_post_gallery_type" android:id="@+id/comments_count_text_view_item_post_gallery_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -286,7 +299,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/downvote_button_item_post_gallery_type" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_gallery_type" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_gallery_type" android:id="@+id/save_button_item_post_gallery_type"

View File

@ -252,6 +252,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_text_type" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_text_type" />
<TextView
android:id="@+id/downvote_text_view_item_post_text_type"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:fontFamily="?attr/font_family"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_text_type" />
<TextView <TextView
android:id="@+id/comments_count_item_post_text_type" android:id="@+id/comments_count_item_post_text_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -265,7 +278,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_text_type" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_text_type" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_text_type" android:id="@+id/save_button_item_post_text_type"

View File

@ -273,6 +273,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_type_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_type_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_video_type_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
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_video_type_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_video_type_autoplay" android:id="@+id/comments_count_item_post_video_type_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -286,7 +299,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_video_type_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_video_type_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_video_type_autoplay" android:id="@+id/save_button_item_post_video_type_autoplay"

View File

@ -273,6 +273,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_type_autoplay" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_type_autoplay" />
<TextView
android:id="@+id/downvote_text_view_item_post_video_type_autoplay"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
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_video_type_autoplay" />
<TextView <TextView
android:id="@+id/comments_count_item_post_video_type_autoplay" android:id="@+id/comments_count_item_post_video_type_autoplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -286,7 +299,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_video_type_autoplay" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_video_type_autoplay" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_video_type_autoplay" android:id="@+id/save_button_item_post_video_type_autoplay"

View File

@ -297,6 +297,19 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_with_preview" /> app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_with_preview" />
<TextView
android:id="@+id/downvote_text_view_item_post_with_preview"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:visibility="gone"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_with_preview" />
<TextView <TextView
android:id="@+id/comments_count_item_post_with_preview" android:id="@+id/comments_count_item_post_with_preview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -310,7 +323,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_with_preview" /> app:layout_constraintStart_toEndOf="@id/downvote_text_view_item_post_with_preview" />
<ImageView <ImageView
android:id="@+id/save_button_item_post_with_preview" android:id="@+id/save_button_item_post_with_preview"

View File

@ -1354,4 +1354,5 @@
<string name="password_cannot_be_empty">The password field cannot be left empty.</string> <string name="password_cannot_be_empty">The password field cannot be left empty.</string>
<!-- TODO: Remove or change this placeholder text --> <!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</string>
<string name="separate_down_and_up_votes">Separate Up and Down votes</string>
</resources> </resources>

View File

@ -56,6 +56,11 @@
app:key="hide_the_number_of_votes_in_comments" app:key="hide_the_number_of_votes_in_comments"
app:title="@string/settings_hide_the_number_of_votes" /> app:title="@string/settings_hide_the_number_of_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="true"
app:key="comment_separate_down_and_up_votes"
app:title="@string/separate_down_and_up_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSeekBarPreference <eu.toldi.infinityforlemmy.customviews.CustomFontSeekBarPreference
app:defaultValue="5" app:defaultValue="5"
android:max="10" android:max="10"

View File

@ -22,11 +22,6 @@
app:key="hide_upvote_ratio" app:key="hide_upvote_ratio"
app:title="@string/settings_hide_upvote_ratio_title" /> app:title="@string/settings_hide_upvote_ratio_title" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="false"
app:key="hide_the_number_of_awards"
app:title="@string/settings_hide_the_number_of_awards" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference <eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="false" app:defaultValue="false"
app:key="hide_subreddit_and_user_prefix" app:key="hide_subreddit_and_user_prefix"
@ -37,6 +32,11 @@
app:key="hide_the_number_of_votes" app:key="hide_the_number_of_votes"
app:title="@string/settings_hide_the_number_of_votes" /> app:title="@string/settings_hide_the_number_of_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="true"
app:key="post_detail_separate_down_and_up_votes"
app:title="@string/separate_down_and_up_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference <eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="false" app:defaultValue="false"
app:key="hide_the_number_of_comments" app:key="hide_the_number_of_comments"

View File

@ -38,6 +38,11 @@
app:key="hide_the_number_of_votes" app:key="hide_the_number_of_votes"
app:title="@string/settings_hide_the_number_of_votes" /> app:title="@string/settings_hide_the_number_of_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="true"
app:key="post_separate_down_and_up_votes"
app:title="@string/separate_down_and_up_votes" />
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference <eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
app:defaultValue="false" app:defaultValue="false"
app:key="hide_the_number_of_comments" app:key="hide_the_number_of_comments"