aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-09-11 03:09:00 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-09-11 03:09:00 +0000
commitcb1d922ac26f5dc4040a793a0b8c45ccc92d7861 (patch)
treede6e949ef03db1c63bcbb3e137ecca9a2dd49de1 /app/src/main/java/ml/docilealligator
parent743c16b1bee74c57d56357be4a0ecbb142fecc4b (diff)
downloadinfinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar.gz
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar.bz2
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar.lz
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar.xz
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.tar.zst
infinity-for-reddit-cb1d922ac26f5dc4040a793a0b8c45ccc92d7861.zip
Continue adding Card Layout 3. Start changing vote button icons.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index 5da7bbc4..740349b8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -6110,22 +6110,27 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ColorStateList previousUpvoteButtonColorTintList = upvoteButton.getBackgroundTintList();
ColorStateList previousDownvoteButtonColorTintList = downvoteButton.getBackgroundTintList();
+ Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon();
+ Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon();
int previousVoteType = post.getVoteType();
String newVoteType;
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
if (previousVoteType != 1) {
//Not upvoted before
post.setVoteType(1);
newVoteType = APIUtils.DIR_UPVOTE;
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mUpvotedColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
} else {
//Upvoted before
post.setVoteType(0);
newVoteType = APIUtils.DIR_UNVOTE;
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
}
if (!mHideTheNumberOfVotes) {
@@ -6140,16 +6145,19 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
post.setVoteType(1);
if (currentPosition == position) {
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mUpvotedColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
}
} else {
post.setVoteType(0);
if (currentPosition == position) {
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
}
}
if (currentPosition == position) {
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
@@ -6167,7 +6175,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType));
}
upvoteButton.setBackgroundTintList(previousUpvoteButtonColorTintList);
+ upvoteButton.setIcon(previousUpvoteButtonDrawable);
downvoteButton.setBackgroundTintList(previousDownvoteButtonColorTintList);
+ downvoteButton.setIcon(previousDownvoteButtonDrawable);
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
@@ -6199,22 +6209,27 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
ColorStateList previousUpvoteButtonColorFilter = upvoteButton.getBackgroundTintList();
ColorStateList previousDownvoteButtonColorFilter = downvoteButton.getBackgroundTintList();
+ Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon();
+ Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon();
int previousVoteType = post.getVoteType();
String newVoteType;
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
if (previousVoteType != -1) {
//Not downvoted before
post.setVoteType(-1);
newVoteType = APIUtils.DIR_DOWNVOTE;
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mDownvotedColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
} else {
//Downvoted before
post.setVoteType(0);
newVoteType = APIUtils.DIR_UNVOTE;
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
}
if (!mHideTheNumberOfVotes) {
@@ -6229,16 +6244,19 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
post.setVoteType(-1);
if (currentPosition == position) {
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mDownvotedColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
}
} else {
post.setVoteType(0);
if (currentPosition == position) {
downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
}
}
if (currentPosition == position) {
upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
@@ -6256,7 +6274,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType));
}
upvoteButton.setBackgroundTintList(previousUpvoteButtonColorFilter);
+ upvoteButton.setIcon(previousUpvoteButtonDrawable);
downvoteButton.setBackgroundTintList(previousDownvoteButtonColorFilter);
+ downvoteButton.setIcon(previousDownvoteButtonDrawable);
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));