Continue implementing custom themes.

This commit is contained in:
Alex Ning 2020-03-17 20:03:15 +08:00
parent 870976068d
commit 3dc2d9fee2
11 changed files with 234 additions and 135 deletions

View File

@ -296,10 +296,15 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
drawer.setBackgroundColor(backgroundColor); drawer.setBackgroundColor(backgroundColor);
drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark()); drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark());
int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor();
subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
navigationView.setBackgroundColor(backgroundColor); navigationView.setBackgroundColor(backgroundColor);
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
applyTabLayoutTheme(tabLayout); applyTabLayoutTheme(tabLayout);
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor)); bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor()));
applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp);
} }

View File

@ -354,7 +354,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
nSubscribersTextView.setTextColor(primaryTextColor); nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor); nOnlineSubscribersTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor); descriptionTextView.setTextColor(primaryTextColor);
bottomNavigationView.setBackgroundColor(backgroundColor); bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor));
int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor();
subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp);
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed(); subscribedColor = mCustomThemeWrapper.getSubscribed();

View File

@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet; import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -170,7 +171,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private int mSingleCommentThreadBackgroundColor; private int mSingleCommentThreadBackgroundColor;
private int mVoteAndReplyUnavailableVoteButtonColor; private int mVoteAndReplyUnavailableVoteButtonColor;
private int mButtonTextColor; private int mButtonTextColor;
private int mPostIconAndInfoColor;
private int mCommentIconAndInfoColor;
private Drawable mCommentIcon;
private float mScale; private float mScale;
private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment;
private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment; private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment;
@ -319,6 +323,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(); mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor();
mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor();
mCommentIconAndInfoColor = customThemeWrapper.getCommentIconAndInfoColor();
mCommentIcon = activity.getDrawable(R.drawable.ic_comment_grey_24dp);
if (mCommentIcon != null) {
DrawableCompat.setTint(mCommentIcon, mPostIconAndInfoColor);
}
mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
@ -485,9 +496,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor); ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor);
break; break;
case 0: case 0:
((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter(); ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostDetailViewHolder) holder).mDownvoteButton.clearColorFilter(); ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mSecondaryTextColor); ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
} }
if (mPost.getPostType() != Post.TEXT_TYPE && mPost.getPostType() != Post.NO_PREVIEW_LINK_TYPE) { if (mPost.getPostType() != Post.TEXT_TYPE && mPost.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
@ -726,25 +737,25 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments())); ((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments()));
if (mPost.isSaved()) { if (mPost.isSaved()) {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
} else { } else {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
} }
((PostDetailViewHolder) holder).saveButton.setOnClickListener(view -> { ((PostDetailViewHolder) holder).mSaveButton.setOnClickListener(view -> {
if (mAccessToken == null) { if (mAccessToken == null) {
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return; return;
} }
if (mPost.isSaved()) { if (mPost.isSaved()) {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
new SaveThing.SaveThingListener() { new SaveThing.SaveThingListener() {
@Override @Override
public void success() { public void success() {
mPost.setSaved(false); mPost.setSaved(false);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost); mCommentRecyclerViewAdapterCallback.updatePost(mPost);
} }
@ -752,19 +763,19 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override @Override
public void failed() { public void failed() {
mPost.setSaved(true); mPost.setSaved(true);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost); mCommentRecyclerViewAdapterCallback.updatePost(mPost);
} }
}); });
} else { } else {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
new SaveThing.SaveThingListener() { new SaveThing.SaveThingListener() {
@Override @Override
public void success() { public void success() {
mPost.setSaved(true); mPost.setSaved(true);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost); mCommentRecyclerViewAdapterCallback.updatePost(mPost);
} }
@ -772,7 +783,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override @Override
public void failed() { public void failed() {
mPost.setSaved(false); mPost.setSaved(false);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost); mCommentRecyclerViewAdapterCallback.updatePost(mPost);
} }
@ -896,12 +907,12 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
switch (comment.getVoteType()) { switch (comment.getVoteType()) {
case CommentData.VOTE_TYPE_UPVOTE: case CommentData.VOTE_TYPE_UPVOTE:
((CommentViewHolder) holder).upVoteButton ((CommentViewHolder) holder).upvoteButton
.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); .setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
break; break;
case CommentData.VOTE_TYPE_DOWNVOTE: case CommentData.VOTE_TYPE_DOWNVOTE:
((CommentViewHolder) holder).downVoteButton ((CommentViewHolder) holder).downvoteButton
.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
break; break;
@ -911,10 +922,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentViewHolder) holder).replyButton ((CommentViewHolder) holder).replyButton
.setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor,
android.graphics.PorterDuff.Mode.SRC_IN); android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).upVoteButton ((CommentViewHolder) holder).upvoteButton
.setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor,
android.graphics.PorterDuff.Mode.SRC_IN); android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).downVoteButton ((CommentViewHolder) holder).downvoteButton
.setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor,
android.graphics.PorterDuff.Mode.SRC_IN); android.graphics.PorterDuff.Mode.SRC_IN);
} }
@ -952,7 +963,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mActivity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE); mActivity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE);
}); });
((CommentViewHolder) holder).upVoteButton.setOnClickListener(view -> { ((CommentViewHolder) holder).upvoteButton.setOnClickListener(view -> {
if (mPost.isArchived()) { if (mPost.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return; return;
@ -966,20 +977,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
int previousVoteType = comment.getVoteType(); int previousVoteType = comment.getVoteType();
String newVoteType; String newVoteType;
((CommentViewHolder) holder).downVoteButton.clearColorFilter(); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) { if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
//Not upvoted before //Not upvoted before
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE); comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
newVoteType = RedditUtils.DIR_UPVOTE; newVoteType = RedditUtils.DIR_UPVOTE;
((CommentViewHolder) holder).upVoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else { } else {
//Upvoted before //Upvoted before
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((CommentViewHolder) holder).upVoteButton.clearColorFilter(); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -990,15 +1001,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
public void onVoteThingSuccess(int position) { public void onVoteThingSuccess(int position) {
if (newVoteType.equals(RedditUtils.DIR_UPVOTE)) { if (newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE); comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
((CommentViewHolder) holder).upVoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else { } else {
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
((CommentViewHolder) holder).upVoteButton.clearColorFilter(); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((CommentViewHolder) holder).downVoteButton.clearColorFilter(); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType())); comment.getScore() + comment.getVoteType()));
} }
@ -1009,7 +1020,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}, comment.getFullName(), newVoteType, holder.getAdapterPosition()); }, comment.getFullName(), newVoteType, holder.getAdapterPosition());
}); });
((CommentViewHolder) holder).downVoteButton.setOnClickListener(view -> { ((CommentViewHolder) holder).downvoteButton.setOnClickListener(view -> {
if (mPost.isArchived()) { if (mPost.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return; return;
@ -1023,20 +1034,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
int previousVoteType = comment.getVoteType(); int previousVoteType = comment.getVoteType();
String newVoteType; String newVoteType;
((CommentViewHolder) holder).upVoteButton.clearColorFilter(); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) { if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
//Not downvoted before //Not downvoted before
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE); comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
newVoteType = RedditUtils.DIR_DOWNVOTE; newVoteType = RedditUtils.DIR_DOWNVOTE;
((CommentViewHolder) holder).downVoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else { } else {
//Downvoted before //Downvoted before
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((CommentViewHolder) holder).downVoteButton.clearColorFilter(); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -1047,15 +1058,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
public void onVoteThingSuccess(int position1) { public void onVoteThingSuccess(int position1) {
if (newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) { if (newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE); comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
((CommentViewHolder) holder).downVoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else { } else {
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
((CommentViewHolder) holder).downVoteButton.clearColorFilter(); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((CommentViewHolder) holder).upVoteButton.clearColorFilter(); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType())); comment.getScore() + comment.getVoteType()));
} }
@ -1682,19 +1693,19 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE); ((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE);
((CommentViewHolder) holder).authorTypeImageView.setVisibility(View.GONE); ((CommentViewHolder) holder).authorTypeImageView.setVisibility(View.GONE);
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE); ((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
((CommentViewHolder) holder).upVoteButton.clearColorFilter(); ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
((CommentViewHolder) holder).downVoteButton.clearColorFilter(); ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).replyButton.clearColorFilter(); ((CommentViewHolder) holder).replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams(); ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
params.width = 0; params.width = 0;
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params); ((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0); ((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
((CommentViewHolder) holder).itemView.setBackgroundColor(mCommentBackgroundColor); ((CommentViewHolder) holder).itemView.setBackgroundColor(mCommentBackgroundColor);
} else if (holder instanceof PostDetailViewHolder) { } else if (holder instanceof PostDetailViewHolder) {
((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter(); ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mSecondaryTextColor); ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
((PostDetailViewHolder) holder).mDownvoteButton.clearColorFilter(); ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostDetailViewHolder) holder).mFlairTextView.setVisibility(View.GONE); ((PostDetailViewHolder) holder).mFlairTextView.setVisibility(View.GONE);
((PostDetailViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE); ((PostDetailViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE);
((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE); ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
@ -1791,7 +1802,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.comments_count_item_post_detail) @BindView(R.id.comments_count_item_post_detail)
TextView commentsCountTextView; TextView commentsCountTextView;
@BindView(R.id.save_button_item_post_detail) @BindView(R.id.save_button_item_post_detail)
ImageView saveButton; ImageView mSaveButton;
@BindView(R.id.share_button_item_post_detail) @BindView(R.id.share_button_item_post_detail)
ImageView mShareButton; ImageView mShareButton;
@ -1859,7 +1870,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
int previousVoteType = mPost.getVoteType(); int previousVoteType = mPost.getVoteType();
String newVoteType; String newVoteType;
mDownvoteButton.clearColorFilter(); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousUpvoteButtonColorFilter == null) { if (previousUpvoteButtonColorFilter == null) {
//Not upvoted before //Not upvoted before
@ -1871,8 +1882,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
//Upvoted before //Upvoted before
mPost.setVoteType(0); mPost.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
mUpvoteButton.clearColorFilter(); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mSecondaryTextColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
} }
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -1889,11 +1900,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mScoreTextView.setTextColor(mUpvotedColor); mScoreTextView.setTextColor(mUpvotedColor);
} else { } else {
mPost.setVoteType(0); mPost.setVoteType(0);
mUpvoteButton.clearColorFilter(); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mSecondaryTextColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
} }
mDownvoteButton.clearColorFilter(); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType())); mPost.getScore() + mPost.getVoteType()));
@ -1933,7 +1944,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
int previousVoteType = mPost.getVoteType(); int previousVoteType = mPost.getVoteType();
String newVoteType; String newVoteType;
mUpvoteButton.clearColorFilter(); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousDownvoteButtonColorFilter == null) { if (previousDownvoteButtonColorFilter == null) {
//Not upvoted before //Not upvoted before
@ -1945,8 +1956,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
//Upvoted before //Upvoted before
mPost.setVoteType(0); mPost.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
mDownvoteButton.clearColorFilter(); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mSecondaryTextColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
} }
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -1963,11 +1974,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mScoreTextView.setTextColor(mDownvotedColor); mScoreTextView.setTextColor(mDownvotedColor);
} else { } else {
mPost.setVoteType(0); mPost.setVoteType(0);
mDownvoteButton.clearColorFilter(); mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mSecondaryTextColor); mScoreTextView.setTextColor(mPostIconAndInfoColor);
} }
mUpvoteButton.clearColorFilter(); mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
mPost.getScore() + mPost.getVoteType())); mPost.getScore() + mPost.getVoteType()));
@ -1995,14 +2006,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
constraintSet.clear(mUpvoteButton.getId(), ConstraintSet.START); constraintSet.clear(mUpvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(mScoreTextView.getId(), ConstraintSet.START); constraintSet.clear(mScoreTextView.getId(), ConstraintSet.START);
constraintSet.clear(mDownvoteButton.getId(), ConstraintSet.START); constraintSet.clear(mDownvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(saveButton.getId(), ConstraintSet.END); constraintSet.clear(mSaveButton.getId(), ConstraintSet.END);
constraintSet.clear(mShareButton.getId(), ConstraintSet.END); constraintSet.clear(mShareButton.getId(), ConstraintSet.END);
constraintSet.connect(mUpvoteButton.getId(), ConstraintSet.END, mScoreTextView.getId(), ConstraintSet.START); constraintSet.connect(mUpvoteButton.getId(), ConstraintSet.END, mScoreTextView.getId(), ConstraintSet.START);
constraintSet.connect(mScoreTextView.getId(), ConstraintSet.END, mDownvoteButton.getId(), ConstraintSet.START); constraintSet.connect(mScoreTextView.getId(), ConstraintSet.END, mDownvoteButton.getId(), ConstraintSet.START);
constraintSet.connect(mDownvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); constraintSet.connect(mDownvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END);
constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END); constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.START, mSaveButton.getId(), ConstraintSet.END);
constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.END, mUpvoteButton.getId(), ConstraintSet.START); constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.END, mUpvoteButton.getId(), ConstraintSet.START);
constraintSet.connect(saveButton.getId(), ConstraintSet.START, mShareButton.getId(), ConstraintSet.END); constraintSet.connect(mSaveButton.getId(), ConstraintSet.START, mShareButton.getId(), ConstraintSet.END);
constraintSet.connect(mShareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); constraintSet.connect(mShareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
constraintSet.setHorizontalBias(commentsCountTextView.getId(), 0); constraintSet.setHorizontalBias(commentsCountTextView.getId(), 0);
constraintSet.applyTo(mBottomConstraintLayout); constraintSet.applyTo(mBottomConstraintLayout);
@ -2032,6 +2043,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mPostIconAndInfoColor);
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
commentsCountTextView.setTextColor(mPostIconAndInfoColor);
commentsCountTextView.setCompoundDrawablesWithIntrinsicBounds(mCommentIcon, null, null, null);
mSaveButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mShareButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }
@ -2049,11 +2067,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@BindView(R.id.bottom_constraint_layout_item_post_comment) @BindView(R.id.bottom_constraint_layout_item_post_comment)
ConstraintLayout bottomConstraintLayout; ConstraintLayout bottomConstraintLayout;
@BindView(R.id.up_vote_button_item_post_comment) @BindView(R.id.up_vote_button_item_post_comment)
ImageView upVoteButton; ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_comment) @BindView(R.id.score_text_view_item_post_comment)
TextView scoreTextView; TextView scoreTextView;
@BindView(R.id.down_vote_button_item_post_comment) @BindView(R.id.down_vote_button_item_post_comment)
ImageView downVoteButton; ImageView downvoteButton;
@BindView(R.id.more_button_item_post_comment) @BindView(R.id.more_button_item_post_comment)
ImageView moreButton; ImageView moreButton;
@BindView(R.id.save_button_item_post_comment) @BindView(R.id.save_button_item_post_comment)
@ -2074,15 +2092,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (mVoteButtonsOnTheRight) { if (mVoteButtonsOnTheRight) {
ConstraintSet constraintSet = new ConstraintSet(); ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(bottomConstraintLayout); constraintSet.clone(bottomConstraintLayout);
constraintSet.clear(upVoteButton.getId(), ConstraintSet.START); constraintSet.clear(upvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(scoreTextView.getId(), ConstraintSet.START); constraintSet.clear(scoreTextView.getId(), ConstraintSet.START);
constraintSet.clear(downVoteButton.getId(), ConstraintSet.START); constraintSet.clear(downvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(expandButton.getId(), ConstraintSet.END); constraintSet.clear(expandButton.getId(), ConstraintSet.END);
constraintSet.clear(saveButton.getId(), ConstraintSet.END); constraintSet.clear(saveButton.getId(), ConstraintSet.END);
constraintSet.clear(replyButton.getId(), ConstraintSet.END); constraintSet.clear(replyButton.getId(), ConstraintSet.END);
constraintSet.connect(upVoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START); constraintSet.connect(upvoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START);
constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downVoteButton.getId(), ConstraintSet.START); constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downvoteButton.getId(), ConstraintSet.START);
constraintSet.connect(downVoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); constraintSet.connect(downvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END);
constraintSet.connect(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END); constraintSet.connect(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END);
constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END); constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END);
constraintSet.connect(saveButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END); constraintSet.connect(saveButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
@ -2102,6 +2120,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
commentMarkdownView.setTextColor(mCommentTextColor); commentMarkdownView.setTextColor(mCommentTextColor);
authorFlairTextView.setTextColor(mAuthorFlairTextColor); authorFlairTextView.setTextColor(mAuthorFlairTextColor);
commentDivider.setBackgroundColor(mDividerColor); commentDivider.setBackgroundColor(mDividerColor);
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
moreButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
expandButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }

View File

@ -79,6 +79,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
private int mDownvotedColor; private int mDownvotedColor;
private int mButtonTextColor; private int mButtonTextColor;
private int mColorAccent; private int mColorAccent;
private int mCommentIconAndInfoColor;
private boolean mVoteButtonsOnTheRight; private boolean mVoteButtonsOnTheRight;
private boolean mShowElapsedTime; private boolean mShowElapsedTime;
private boolean mShowCommentDivider; private boolean mShowCommentDivider;
@ -138,6 +139,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
mDownvotedColor = customThemeWrapper.getDownvoted(); mDownvotedColor = customThemeWrapper.getDownvoted();
mButtonTextColor = customThemeWrapper.getButtonTextColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor();
mColorAccent = customThemeWrapper.getColorAccent(); mColorAccent = customThemeWrapper.getColorAccent();
mCommentIconAndInfoColor = customThemeWrapper.getCommentIconAndInfoColor();
} }
@NonNull @NonNull
@ -235,7 +237,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
int previousVoteType = comment.getVoteType(); int previousVoteType = comment.getVoteType();
String newVoteType; String newVoteType;
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) { if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
//Not upvoted before //Not upvoted before
@ -248,8 +250,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
//Upvoted before //Upvoted before
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -264,11 +266,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
((DataViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else { } else {
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType())); comment.getScore() + comment.getVoteType()));
} }
@ -288,7 +290,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
int previousVoteType = comment.getVoteType(); int previousVoteType = comment.getVoteType();
String newVoteType; String newVoteType;
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) { if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
//Not downvoted before //Not downvoted before
@ -300,8 +302,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
//Downvoted before //Downvoted before
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
@ -316,11 +318,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
((DataViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else { } else {
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType())); comment.getScore() + comment.getVoteType()));
} }
@ -395,9 +397,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override @Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof DataViewHolder) { if (holder instanceof DataViewHolder) {
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
} }
} }
@ -494,6 +496,13 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
authorTextView.setTextColor(mUsernameColor); authorTextView.setTextColor(mUsernameColor);
commentTimeTextView.setTextColor(mSecondaryTextColor); commentTimeTextView.setTextColor(mSecondaryTextColor);
commentMarkdownView.setTextColor(mCommentColor); commentMarkdownView.setTextColor(mCommentColor);
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
moreButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
expandButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
commentDivider.setBackgroundColor(mDividerColor); commentDivider.setBackgroundColor(mDividerColor);
} }
} }

View File

@ -60,6 +60,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
private int primaryTextColor; private int primaryTextColor;
private int secondaryTextColor; private int secondaryTextColor;
private int dividerColor; private int dividerColor;
private int primaryIconColor;
public NavigationDrawerRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper, public NavigationDrawerRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper,
String accountName, String userIconUrl, String accountName, String userIconUrl,
@ -78,6 +79,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
primaryTextColor = customThemeWrapper.getPrimaryTextColor(); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
secondaryTextColor = customThemeWrapper.getSecondaryTextColor(); secondaryTextColor = customThemeWrapper.getSecondaryTextColor();
dividerColor = customThemeWrapper.getDividerColor(); dividerColor = customThemeWrapper.getDividerColor();
primaryIconColor = customThemeWrapper.getPrimaryIconColor();
} }
@Override @Override
@ -280,14 +282,12 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
if (isNSFWEnabled) { if (isNSFWEnabled) {
isNSFWEnabled = false; isNSFWEnabled = false;
((MenuItemViewHolder) holder).menuTextView.setText(R.string.enable_nsfw); ((MenuItemViewHolder) holder).menuTextView.setText(R.string.enable_nsfw);
((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_on_24dp));
R.drawable.ic_nsfw_on_24dp, 0, 0, 0);
itemClickListener.onMenuClick(R.string.disable_nsfw); itemClickListener.onMenuClick(R.string.disable_nsfw);
} else { } else {
isNSFWEnabled = true; isNSFWEnabled = true;
((MenuItemViewHolder) holder).menuTextView.setText(R.string.disable_nsfw); ((MenuItemViewHolder) holder).menuTextView.setText(R.string.disable_nsfw);
((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_off_24dp));
R.drawable.ic_nsfw_off_24dp, 0, 0, 0);
itemClickListener.onMenuClick(R.string.enable_nsfw); itemClickListener.onMenuClick(R.string.enable_nsfw);
} }
}); });
@ -333,8 +333,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
if (stringId != 0) { if (stringId != 0) {
((MenuItemViewHolder) holder).menuTextView.setText(stringId); ((MenuItemViewHolder) holder).menuTextView.setText(stringId);
((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(drawableId));
drawableId, 0, 0, 0);
if (setOnClickListener) { if (setOnClickListener) {
int finalStringId = stringId; int finalStringId = stringId;
((MenuItemViewHolder) holder).itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId)); ((MenuItemViewHolder) holder).itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId));
@ -461,12 +460,16 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
} }
class MenuItemViewHolder extends RecyclerView.ViewHolder { class MenuItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.image_view_item_nav_drawer_menu_item)
ImageView imageView;
@BindView(R.id.text_view_item_nav_drawer_menu_item)
TextView menuTextView; TextView menuTextView;
MenuItemViewHolder(@NonNull View itemView) { MenuItemViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
menuTextView = (TextView) itemView; ButterKnife.bind(this, itemView);
menuTextView.setTextColor(primaryTextColor); menuTextView.setTextColor(primaryTextColor);
imageView.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }

View File

@ -23,6 +23,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet; import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.paging.PagedListAdapter; import androidx.paging.PagedListAdapter;
import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -125,6 +126,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private int mDownvotedColor; private int mDownvotedColor;
private int mVoteAndReplyUnavailableVoteButtonColor; private int mVoteAndReplyUnavailableVoteButtonColor;
private int mButtonTextColor; private int mButtonTextColor;
private int mPostIconAndInfoColor;
private float mScale; private float mScale;
private boolean mDisplaySubredditName; private boolean mDisplaySubredditName;
private boolean mVoteButtonsOnTheRight; private boolean mVoteButtonsOnTheRight;
@ -133,6 +135,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private boolean mShowElapsedTime; private boolean mShowElapsedTime;
private boolean mShowDividerInCompactLayout; private boolean mShowDividerInCompactLayout;
private boolean mShowAbsoluteNumberOfVotes; private boolean mShowAbsoluteNumberOfVotes;
private Drawable mCommentIcon;
private NetworkState networkState; private NetworkState networkState;
private Callback mCallback; private Callback mCallback;
private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment;
@ -185,7 +188,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mDownvotedColor = customThemeWrapper.getDownvoted(); mDownvotedColor = customThemeWrapper.getDownvoted();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor();
mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor();
mCommentIcon = activity.getDrawable(R.drawable.ic_comment_grey_24dp);
if (mCommentIcon != null) {
DrawableCompat.setTint(mCommentIcon, mPostIconAndInfoColor);
}
mScale = activity.getResources().getDisplayMetrics().density; mScale = activity.getResources().getDisplayMetrics().density;
mGlide = Glide.with(mActivity.getApplicationContext()); mGlide = Glide.with(mActivity.getApplicationContext());
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
@ -599,7 +607,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
int previousVoteType = post.getVoteType(); int previousVoteType = post.getVoteType();
String newVoteType; String newVoteType;
((PostViewHolder) holder).downvoteButton.clearColorFilter(); ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousUpvoteButtonColorFilter == null) { if (previousUpvoteButtonColorFilter == null) {
//Not upvoted before //Not upvoted before
@ -612,8 +620,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
//Upvoted before //Upvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((PostViewHolder) holder).upvoteButton.clearColorFilter(); ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
@ -628,11 +636,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else { } else {
post.setVoteType(0); post.setVoteType(0);
((PostViewHolder) holder).upvoteButton.clearColorFilter(); ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostViewHolder) holder).downvoteButton.clearColorFilter(); ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
@ -670,7 +678,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
int previousVoteType = post.getVoteType(); int previousVoteType = post.getVoteType();
String newVoteType; String newVoteType;
((PostViewHolder) holder).upvoteButton.clearColorFilter(); ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousDownvoteButtonColorFilter == null) { if (previousDownvoteButtonColorFilter == null) {
//Not downvoted before //Not downvoted before
@ -683,8 +691,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
//Downvoted before //Downvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((PostViewHolder) holder).downvoteButton.clearColorFilter(); ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
@ -699,11 +707,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else { } else {
post.setVoteType(0); post.setVoteType(0);
((PostViewHolder) holder).downvoteButton.clearColorFilter(); ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostViewHolder) holder).upvoteButton.clearColorFilter(); ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
@ -1145,7 +1153,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
int previousVoteType = post.getVoteType(); int previousVoteType = post.getVoteType();
String newVoteType; String newVoteType;
((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousUpvoteButtonColorFilter == null) { if (previousUpvoteButtonColorFilter == null) {
//Not upvoted before //Not upvoted before
@ -1158,8 +1166,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
//Upvoted before //Upvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
@ -1174,11 +1182,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else { } else {
post.setVoteType(0); post.setVoteType(0);
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
@ -1216,7 +1224,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
int previousVoteType = post.getVoteType(); int previousVoteType = post.getVoteType();
String newVoteType; String newVoteType;
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
if (previousDownvoteButtonColorFilter == null) { if (previousDownvoteButtonColorFilter == null) {
//Not downvoted before //Not downvoted before
@ -1229,8 +1237,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
//Downvoted before //Downvoted before
post.setVoteType(0); post.setVoteType(0);
newVoteType = RedditUtils.DIR_UNVOTE; newVoteType = RedditUtils.DIR_UNVOTE;
((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
@ -1245,11 +1253,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else { } else {
post.setVoteType(0); post.setVoteType(0);
((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
} }
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); ((PostCompactViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType()));
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
@ -1509,9 +1517,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); ((PostViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((PostViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE); ((PostViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
((PostViewHolder) holder).contentTextView.setVisibility(View.GONE); ((PostViewHolder) holder).contentTextView.setVisibility(View.GONE);
((PostViewHolder) holder).upvoteButton.clearColorFilter(); ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
((PostViewHolder) holder).downvoteButton.clearColorFilter(); ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} else if (holder instanceof PostCompactViewHolder) { } else if (holder instanceof PostCompactViewHolder) {
mGlide.clear(((PostCompactViewHolder) holder).imageView); mGlide.clear(((PostCompactViewHolder) holder).imageView);
mGlide.clear(((PostCompactViewHolder) holder).iconGifImageView); mGlide.clear(((PostCompactViewHolder) holder).iconGifImageView);
@ -1529,9 +1537,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE);
((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.GONE);
((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor);
((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }
@ -1654,6 +1662,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
linkTextView.setTextColor(mSecondaryTextColor); linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
commentsCountTextView.setTextColor(mPostIconAndInfoColor);
commentsCountTextView.setCompoundDrawablesWithIntrinsicBounds(mCommentIcon, null, null, null);
saveButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
shareButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }
@ -1761,6 +1776,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
linkTextView.setTextColor(mSecondaryTextColor); linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mPostIconAndInfoColor);
downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
commentsCountTextView.setTextColor(mPostIconAndInfoColor);
commentsCountTextView.setCompoundDrawablesWithIntrinsicBounds(mCommentIcon, null, null, null);
saveButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
shareButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
} }
} }

View File

@ -110,9 +110,29 @@ public class CustomThemeWrapper {
getDefaultColor("#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getBottomAppBarBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BOTTOM_APP_BAR_BACKGROUND_COLOR,
getDefaultColor("#FFFFFF", "#121212", "#000000"));
}
public int getPrimaryIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.PRIMARY_ICON_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
}
public int getPostIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR,
getDefaultColor("#808080", "#808080", "#808080"));
}
public int getCommentIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_ICON_AND_INFO_COLOR,
getDefaultColor("#808080", "#808080", "#808080"));
}
public int getToolbarPrimaryTextAndIconColor() { public int getToolbarPrimaryTextAndIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getToolbarAndTabBackgroundColor() { public int getToolbarAndTabBackgroundColor() {
@ -265,11 +285,6 @@ public class CustomThemeWrapper {
getDefaultColor("#00BA81", "#00BA81", "#00BA81")); getDefaultColor("#00BA81", "#00BA81", "#00BA81"));
} }
public int getNotificationIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NOTIFICATION_ICON_COLOR,
getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
}
public int getSingleCommentThreadBackgroundColor() { public int getSingleCommentThreadBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND,
getDefaultColor("#B3E5F9", "#123E77", "#123E77")); getDefaultColor("#B3E5F9", "#123E77", "#123E77"));

View File

@ -63,7 +63,7 @@ public class PullNotificationWorker extends Worker {
public Result doWork() { public Result doWork() {
try { try {
List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts(); List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts();
int color = mCustomThemeWrapper.getNotificationIconColor(); int color = mCustomThemeWrapper.getColorPrimaryLightTheme();
for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) { for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) {
Account account = accounts.get(accountIndex); Account account = accounts.get(accountIndex);

View File

@ -130,7 +130,7 @@ public class SubmitPostService extends Service {
.setContentTitle(getString(stringResId)) .setContentTitle(getString(stringResId))
.setContentText(getString(R.string.please_wait)) .setContentText(getString(R.string.please_wait))
.setSmallIcon(R.drawable.ic_notification) .setSmallIcon(R.drawable.ic_notification)
.setColor(mCustomThemeWrapper.getNotificationIconColor()) .setColor(mCustomThemeWrapper.getColorPrimaryLightTheme())
.build(); .build();
} }

View File

@ -21,6 +21,10 @@ public class CustomThemeSharedPreferencesUtils {
public static final String BACKGROUND_COLOR = "backgroundColor"; public static final String BACKGROUND_COLOR = "backgroundColor";
public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor"; public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor";
public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor"; public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor";
public static final String BOTTOM_APP_BAR_BACKGROUND_COLOR = "bottomAppBarBackgroundColor";
public static final String PRIMARY_ICON_COLOR = "primaryIconColor";
public static final String POST_ICON_AND_INFO_COLOR = "postIconAndInfoColor";
public static final String COMMENT_ICON_AND_INFO_COLOR = "commentIconAndInfoColor";
public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor"; public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor";
public static final String TOOLBAR_AND_TAB_BACKGROUND_COLOR = "toolbarAndTabBackgroundColor"; public static final String TOOLBAR_AND_TAB_BACKGROUND_COLOR = "toolbarAndTabBackgroundColor";
public static final String CIRCULAR_PROGRESS_BAR_BACKGROUND = "circularProgressBarBackground"; public static final String CIRCULAR_PROGRESS_BAR_BACKGROUND = "circularProgressBarBackground";
@ -52,7 +56,6 @@ public class CustomThemeSharedPreferencesUtils {
public static final String AUTHOR_FLAIR_TEXT_COLOR = "authorFlairTextColor"; public static final String AUTHOR_FLAIR_TEXT_COLOR = "authorFlairTextColor";
public static final String SUBMITTER = "submitter"; public static final String SUBMITTER = "submitter";
public static final String MODERATOR = "moderator"; public static final String MODERATOR = "moderator";
public static final String NOTIFICATION_ICON_COLOR = "notificationIconColor";
public static final String SINGLE_COMMENT_THREAD_BACKGROUND = "singleCommentThreadBackgroundColor"; public static final String SINGLE_COMMENT_THREAD_BACKGROUND = "singleCommentThreadBackgroundColor";
public static final String UNREAD_MESSAGE_BACKGROUND_COLOR = "unreadMessageBackgroundColor"; public static final String UNREAD_MESSAGE_BACKGROUND_COLOR = "unreadMessageBackgroundColor";
public static final String DIVIDER_COLOR = "dividerColor"; public static final String DIVIDER_COLOR = "dividerColor";

View File

@ -1,12 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:drawablePadding="32dp"
android:focusable="true"
android:gravity="center_vertical"
android:padding="16dp" android:padding="16dp"
android:textColor="?attr/primaryTextColor" android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="@+id/image_view_item_nav_drawer_menu_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/text_view_item_nav_drawer_menu_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="?attr/font_default" /> android:textSize="?attr/font_default" />
</LinearLayout>