aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java20
-rw-r--r--app/src/main/res/layout/item_post_card_2_with_preview.xml4
2 files changed, 22 insertions, 2 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));
diff --git a/app/src/main/res/layout/item_post_card_2_with_preview.xml b/app/src/main/res/layout/item_post_card_2_with_preview.xml
index 88edcd81..eb67faac 100644
--- a/app/src/main/res/layout/item_post_card_2_with_preview.xml
+++ b/app/src/main/res/layout/item_post_card_2_with_preview.xml
@@ -235,7 +235,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
- android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:src="@drawable/ic_upvote_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
@@ -260,7 +260,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
- android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:src="@drawable/ic_downvote_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"