aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-09-11 03:41:30 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-09-11 03:41:30 +0000
commitd27023dde2ca226189f6f7279d051a156b123043 (patch)
treebfc8f771e97f7c1b9e10f72699225cdaf5eafbb0 /app/src
parent1b92ac0837dd5931289e35ecef9d0e0307b5419a (diff)
downloadinfinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar.gz
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar.bz2
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar.lz
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar.xz
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.tar.zst
infinity-for-reddit-d27023dde2ca226189f6f7279d051a156b123043.zip
Continue adding Card Layout 3.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java56
1 files changed, 36 insertions, 20 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 740349b8..2bf9c984 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -6108,29 +6108,32 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
return;
}
- ColorStateList previousUpvoteButtonColorTintList = upvoteButton.getBackgroundTintList();
- ColorStateList previousDownvoteButtonColorTintList = downvoteButton.getBackgroundTintList();
+ int previousUpvoteButtonTextColor = upvoteButton.getCurrentTextColor();
+ int previousDownvoteButtonTextColor = downvoteButton.getCurrentTextColor();
Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon();
Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon();
int previousVoteType = post.getVoteType();
String newVoteType;
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setTextColor(mPostIconAndInfoColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
if (previousVoteType != 1) {
//Not upvoted before
post.setVoteType(1);
newVoteType = APIUtils.DIR_UPVOTE;
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mUpvotedColor));
+ upvoteButton.setTextColor(mUpvotedColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
} else {
//Upvoted before
post.setVoteType(0);
newVoteType = APIUtils.DIR_UNVOTE;
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setTextColor(mPostIconAndInfoColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
}
if (!mHideTheNumberOfVotes) {
@@ -6144,20 +6147,23 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
if (newVoteType.equals(APIUtils.DIR_UPVOTE)) {
post.setVoteType(1);
if (currentPosition == position) {
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mUpvotedColor));
+ upvoteButton.setTextColor(mUpvotedColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor));
}
} else {
post.setVoteType(0);
if (currentPosition == position) {
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setTextColor(mPostIconAndInfoColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
}
}
if (currentPosition == position) {
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setTextColor(mPostIconAndInfoColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
@@ -6174,10 +6180,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType));
}
- upvoteButton.setBackgroundTintList(previousUpvoteButtonColorTintList);
+ upvoteButton.setTextColor(previousUpvoteButtonTextColor);
upvoteButton.setIcon(previousUpvoteButtonDrawable);
- downvoteButton.setBackgroundTintList(previousDownvoteButtonColorTintList);
+ upvoteButton.setIconTint(ColorStateList.valueOf(previousUpvoteButtonTextColor));
+ downvoteButton.setTextColor(previousDownvoteButtonTextColor);
downvoteButton.setIcon(previousDownvoteButtonDrawable);
+ downvoteButton.setIconTint(ColorStateList.valueOf(previousDownvoteButtonTextColor));
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
@@ -6207,29 +6215,32 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
return;
}
- ColorStateList previousUpvoteButtonColorFilter = upvoteButton.getBackgroundTintList();
- ColorStateList previousDownvoteButtonColorFilter = downvoteButton.getBackgroundTintList();
+ int previousUpvoteButtonTextColor = upvoteButton.getTextColors().getDefaultColor();
+ int previousDownvoteButtonTextColor = downvoteButton.getTextColors().getDefaultColor();
Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon();
Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon();
int previousVoteType = post.getVoteType();
String newVoteType;
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setTextColor(mPostIconAndInfoColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
if (previousVoteType != -1) {
//Not downvoted before
post.setVoteType(-1);
newVoteType = APIUtils.DIR_DOWNVOTE;
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mDownvotedColor));
+ downvoteButton.setTextColor(mDownvotedColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
} else {
//Downvoted before
post.setVoteType(0);
newVoteType = APIUtils.DIR_UNVOTE;
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setTextColor(mPostIconAndInfoColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
}
if (!mHideTheNumberOfVotes) {
@@ -6243,20 +6254,23 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) {
post.setVoteType(-1);
if (currentPosition == position) {
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mDownvotedColor));
+ downvoteButton.setTextColor(mDownvotedColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor));
}
} else {
post.setVoteType(0);
if (currentPosition == position) {
- downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ downvoteButton.setTextColor(mPostIconAndInfoColor);
downvoteButton.setIconResource(R.drawable.ic_downvote_24dp);
+ downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
}
}
if (currentPosition == position) {
- upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mPostIconAndInfoColor));
+ upvoteButton.setTextColor(mPostIconAndInfoColor);
upvoteButton.setIconResource(R.drawable.ic_upvote_24dp);
+ upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor));
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
}
@@ -6273,10 +6287,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
if (!mHideTheNumberOfVotes) {
upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType));
}
- upvoteButton.setBackgroundTintList(previousUpvoteButtonColorFilter);
+ upvoteButton.setTextColor(previousUpvoteButtonTextColor);
upvoteButton.setIcon(previousUpvoteButtonDrawable);
- downvoteButton.setBackgroundTintList(previousDownvoteButtonColorFilter);
+ upvoteButton.setIconTint(ColorStateList.valueOf(previousUpvoteButtonTextColor));
+ downvoteButton.setTextColor(previousDownvoteButtonTextColor);
downvoteButton.setIcon(previousDownvoteButtonDrawable);
+ downvoteButton.setIconTint(ColorStateList.valueOf(previousDownvoteButtonTextColor));
}
EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));