diff options
Diffstat (limited to 'app')
11 files changed, 233 insertions, 134 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index b03e04d6..9bc49a1a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -296,10 +296,15 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); drawer.setBackgroundColor(backgroundColor); 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); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyTabLayoutTheme(tabLayout); - bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor)); + bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor())); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 039c07dd..d34b133b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -354,7 +354,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp nSubscribersTextView.setTextColor(primaryTextColor); nOnlineSubscribersTextView.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); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); subscribedColor = mCustomThemeWrapper.getSubscribed(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 1bd656b4..5d7e2b79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -27,6 +27,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; +import androidx.core.graphics.drawable.DrawableCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -170,7 +171,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private int mSingleCommentThreadBackgroundColor; private int mVoteAndReplyUnavailableVoteButtonColor; private int mButtonTextColor; + private int mPostIconAndInfoColor; + private int mCommentIconAndInfoColor; + private Drawable mCommentIcon; private float mScale; private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment; @@ -319,6 +323,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(); mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); 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(); mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); @@ -485,9 +496,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor); break; case 0: - ((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter(); - ((PostDetailViewHolder) holder).mDownvoteButton.clearColorFilter(); - ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mSecondaryTextColor); + ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor); } 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())); if (mPost.isSaved()) { - ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); } 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) { Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); return; } 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(), new SaveThing.SaveThingListener() { @Override public void success() { 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(); mCommentRecyclerViewAdapterCallback.updatePost(mPost); } @@ -752,19 +763,19 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy @Override public void failed() { 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(); mCommentRecyclerViewAdapterCallback.updatePost(mPost); } }); } 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(), new SaveThing.SaveThingListener() { @Override public void success() { 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(); mCommentRecyclerViewAdapterCallback.updatePost(mPost); } @@ -772,7 +783,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy @Override public void failed() { 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(); mCommentRecyclerViewAdapterCallback.updatePost(mPost); } @@ -896,12 +907,12 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy switch (comment.getVoteType()) { case CommentData.VOTE_TYPE_UPVOTE: - ((CommentViewHolder) holder).upVoteButton + ((CommentViewHolder) holder).upvoteButton .setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); break; case CommentData.VOTE_TYPE_DOWNVOTE: - ((CommentViewHolder) holder).downVoteButton + ((CommentViewHolder) holder).downvoteButton .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); break; @@ -911,10 +922,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ((CommentViewHolder) holder).replyButton .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, android.graphics.PorterDuff.Mode.SRC_IN); - ((CommentViewHolder) holder).upVoteButton + ((CommentViewHolder) holder).upvoteButton .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, android.graphics.PorterDuff.Mode.SRC_IN); - ((CommentViewHolder) holder).downVoteButton + ((CommentViewHolder) holder).downvoteButton .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, 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); }); - ((CommentViewHolder) holder).upVoteButton.setOnClickListener(view -> { + ((CommentViewHolder) holder).upvoteButton.setOnClickListener(view -> { if (mPost.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -966,20 +977,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int previousVoteType = comment.getVoteType(); String newVoteType; - ((CommentViewHolder) holder).downVoteButton.clearColorFilter(); + ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) { //Not upvoted before comment.setVoteType(CommentData.VOTE_TYPE_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); } else { //Upvoted before comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); newVoteType = RedditUtils.DIR_UNVOTE; - ((CommentViewHolder) holder).upVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); } ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -990,15 +1001,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy public void onVoteThingSuccess(int position) { if (newVoteType.equals(RedditUtils.DIR_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); } else { comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); - ((CommentViewHolder) holder).upVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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, comment.getScore() + comment.getVoteType())); } @@ -1009,7 +1020,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy }, comment.getFullName(), newVoteType, holder.getAdapterPosition()); }); - ((CommentViewHolder) holder).downVoteButton.setOnClickListener(view -> { + ((CommentViewHolder) holder).downvoteButton.setOnClickListener(view -> { if (mPost.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1023,20 +1034,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int previousVoteType = comment.getVoteType(); String newVoteType; - ((CommentViewHolder) holder).upVoteButton.clearColorFilter(); + ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) { //Not downvoted before comment.setVoteType(CommentData.VOTE_TYPE_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); } else { //Downvoted before comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); newVoteType = RedditUtils.DIR_UNVOTE; - ((CommentViewHolder) holder).downVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); } ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -1047,15 +1058,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy public void onVoteThingSuccess(int position1) { if (newVoteType.equals(RedditUtils.DIR_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); } else { comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); - ((CommentViewHolder) holder).downVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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, comment.getScore() + comment.getVoteType())); } @@ -1682,19 +1693,19 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE); ((CommentViewHolder) holder).authorTypeImageView.setVisibility(View.GONE); ((CommentViewHolder) holder).expandButton.setVisibility(View.GONE); - ((CommentViewHolder) holder).upVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); - ((CommentViewHolder) holder).downVoteButton.clearColorFilter(); - ((CommentViewHolder) holder).replyButton.clearColorFilter(); + ((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); + ((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((CommentViewHolder) holder).replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams(); params.width = 0; ((CommentViewHolder) holder).verticalBlock.setLayoutParams(params); ((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0); ((CommentViewHolder) holder).itemView.setBackgroundColor(mCommentBackgroundColor); } else if (holder instanceof PostDetailViewHolder) { - ((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter(); - ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mSecondaryTextColor); - ((PostDetailViewHolder) holder).mDownvoteButton.clearColorFilter(); + ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor); + ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); ((PostDetailViewHolder) holder).mFlairTextView.setVisibility(View.GONE); ((PostDetailViewHolder) holder).mSpoilerTextView.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) TextView commentsCountTextView; @BindView(R.id.save_button_item_post_detail) - ImageView saveButton; + ImageView mSaveButton; @BindView(R.id.share_button_item_post_detail) ImageView mShareButton; @@ -1859,7 +1870,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int previousVoteType = mPost.getVoteType(); String newVoteType; - mDownvoteButton.clearColorFilter(); + mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousUpvoteButtonColorFilter == null) { //Not upvoted before @@ -1871,8 +1882,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy //Upvoted before mPost.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - mUpvoteButton.clearColorFilter(); - mScoreTextView.setTextColor(mSecondaryTextColor); + mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + mScoreTextView.setTextColor(mPostIconAndInfoColor); } mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -1889,11 +1900,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mScoreTextView.setTextColor(mUpvotedColor); } else { mPost.setVoteType(0); - mUpvoteButton.clearColorFilter(); - mScoreTextView.setTextColor(mSecondaryTextColor); + mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + mScoreTextView.setTextColor(mPostIconAndInfoColor); } - mDownvoteButton.clearColorFilter(); + mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); @@ -1933,7 +1944,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int previousVoteType = mPost.getVoteType(); String newVoteType; - mUpvoteButton.clearColorFilter(); + mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousDownvoteButtonColorFilter == null) { //Not upvoted before @@ -1945,8 +1956,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy //Upvoted before mPost.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - mDownvoteButton.clearColorFilter(); - mScoreTextView.setTextColor(mSecondaryTextColor); + mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + mScoreTextView.setTextColor(mPostIconAndInfoColor); } mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -1963,11 +1974,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mScoreTextView.setTextColor(mDownvotedColor); } else { mPost.setVoteType(0); - mDownvoteButton.clearColorFilter(); - mScoreTextView.setTextColor(mSecondaryTextColor); + mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + mScoreTextView.setTextColor(mPostIconAndInfoColor); } - mUpvoteButton.clearColorFilter(); + mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); @@ -1995,14 +2006,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy constraintSet.clear(mUpvoteButton.getId(), ConstraintSet.START); constraintSet.clear(mScoreTextView.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.connect(mUpvoteButton.getId(), ConstraintSet.END, mScoreTextView.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(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(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.setHorizontalBias(commentsCountTextView.getId(), 0); constraintSet.applyTo(mBottomConstraintLayout); @@ -2032,6 +2043,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); 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) ConstraintLayout bottomConstraintLayout; @BindView(R.id.up_vote_button_item_post_comment) - ImageView upVoteButton; + ImageView upvoteButton; @BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView; @BindView(R.id.down_vote_button_item_post_comment) - ImageView downVoteButton; + ImageView downvoteButton; @BindView(R.id.more_button_item_post_comment) ImageView moreButton; @BindView(R.id.save_button_item_post_comment) @@ -2074,15 +2092,15 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy if (mVoteButtonsOnTheRight) { ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(bottomConstraintLayout); - constraintSet.clear(upVoteButton.getId(), ConstraintSet.START); + constraintSet.clear(upvoteButton.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(saveButton.getId(), ConstraintSet.END); constraintSet.clear(replyButton.getId(), ConstraintSet.END); - constraintSet.connect(upVoteButton.getId(), ConstraintSet.END, scoreTextView.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(upvoteButton.getId(), ConstraintSet.END, scoreTextView.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(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END); constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.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); authorFlairTextView.setTextColor(mAuthorFlairTextColor); 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); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java index c66c04ba..12b05085 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java @@ -79,6 +79,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment private int mDownvotedColor; private int mButtonTextColor; private int mColorAccent; + private int mCommentIconAndInfoColor; private boolean mVoteButtonsOnTheRight; private boolean mShowElapsedTime; private boolean mShowCommentDivider; @@ -138,6 +139,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment mDownvotedColor = customThemeWrapper.getDownvoted(); mButtonTextColor = customThemeWrapper.getButtonTextColor(); mColorAccent = customThemeWrapper.getColorAccent(); + mCommentIconAndInfoColor = customThemeWrapper.getCommentIconAndInfoColor(); } @NonNull @@ -235,7 +237,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment int previousVoteType = comment.getVoteType(); String newVoteType; - ((DataViewHolder) holder).downvoteButton.clearColorFilter(); + ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) { //Not upvoted before @@ -248,8 +250,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment //Upvoted before comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); newVoteType = RedditUtils.DIR_UNVOTE; - ((DataViewHolder) holder).upvoteButton.clearColorFilter(); - ((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); } ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -264,11 +266,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment ((DataViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); } else { comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); - ((DataViewHolder) holder).upvoteButton.clearColorFilter(); - ((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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, comment.getScore() + comment.getVoteType())); } @@ -288,7 +290,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment int previousVoteType = comment.getVoteType(); String newVoteType; - ((DataViewHolder) holder).upvoteButton.clearColorFilter(); + ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) { //Not downvoted before @@ -300,8 +302,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment //Downvoted before comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); newVoteType = RedditUtils.DIR_UNVOTE; - ((DataViewHolder) holder).downvoteButton.clearColorFilter(); - ((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); } ((DataViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -316,11 +318,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment ((DataViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); } else { comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE); - ((DataViewHolder) holder).downvoteButton.clearColorFilter(); - ((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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, comment.getScore() + comment.getVoteType())); } @@ -395,9 +397,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { if (holder instanceof DataViewHolder) { - ((DataViewHolder) holder).upvoteButton.clearColorFilter(); - ((DataViewHolder) holder).downvoteButton.clearColorFilter(); - ((DataViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((DataViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((DataViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((DataViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); } } @@ -494,6 +496,13 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment authorTextView.setTextColor(mUsernameColor); commentTimeTextView.setTextColor(mSecondaryTextColor); 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); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java index 87863c0d..c5fa30b2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java @@ -60,6 +60,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re private int primaryTextColor; private int secondaryTextColor; private int dividerColor; + private int primaryIconColor; public NavigationDrawerRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper, String accountName, String userIconUrl, @@ -78,6 +79,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re primaryTextColor = customThemeWrapper.getPrimaryTextColor(); secondaryTextColor = customThemeWrapper.getSecondaryTextColor(); dividerColor = customThemeWrapper.getDividerColor(); + primaryIconColor = customThemeWrapper.getPrimaryIconColor(); } @Override @@ -280,14 +282,12 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re if (isNSFWEnabled) { isNSFWEnabled = false; ((MenuItemViewHolder) holder).menuTextView.setText(R.string.enable_nsfw); - ((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( - R.drawable.ic_nsfw_on_24dp, 0, 0, 0); + ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_on_24dp)); itemClickListener.onMenuClick(R.string.disable_nsfw); } else { isNSFWEnabled = true; ((MenuItemViewHolder) holder).menuTextView.setText(R.string.disable_nsfw); - ((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( - R.drawable.ic_nsfw_off_24dp, 0, 0, 0); + ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_off_24dp)); itemClickListener.onMenuClick(R.string.enable_nsfw); } }); @@ -333,8 +333,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re if (stringId != 0) { ((MenuItemViewHolder) holder).menuTextView.setText(stringId); - ((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds( - drawableId, 0, 0, 0); + ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(drawableId)); if (setOnClickListener) { int finalStringId = stringId; ((MenuItemViewHolder) holder).itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId)); @@ -461,12 +460,16 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re } 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; MenuItemViewHolder(@NonNull View itemView) { super(itemView); - menuTextView = (TextView) itemView; + ButterKnife.bind(this, itemView); menuTextView.setTextColor(primaryTextColor); + imageView.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 8c0a2444..77f990a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -23,6 +23,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; +import androidx.core.graphics.drawable.DrawableCompat; import androidx.paging.PagedListAdapter; import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.RecyclerView; @@ -125,6 +126,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private int mDownvotedColor; private int mVoteAndReplyUnavailableVoteButtonColor; private int mButtonTextColor; + private int mPostIconAndInfoColor; private float mScale; private boolean mDisplaySubredditName; private boolean mVoteButtonsOnTheRight; @@ -133,6 +135,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private boolean mShowElapsedTime; private boolean mShowDividerInCompactLayout; private boolean mShowAbsoluteNumberOfVotes; + private Drawable mCommentIcon; private NetworkState networkState; private Callback mCallback; private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; @@ -185,7 +188,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mDownvotedColor = customThemeWrapper.getDownvoted(); mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); 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; mGlide = Glide.with(mActivity.getApplicationContext()); mRedditDataRoomDatabase = redditDataRoomDatabase; @@ -599,7 +607,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView int previousVoteType = post.getVoteType(); String newVoteType; - ((PostViewHolder) holder).downvoteButton.clearColorFilter(); + ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousUpvoteButtonColorFilter == null) { //Not upvoted before @@ -612,8 +620,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView //Upvoted before post.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - ((PostViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); } ((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); } else { post.setVoteType(0); - ((PostViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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())); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -670,7 +678,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView int previousVoteType = post.getVoteType(); String newVoteType; - ((PostViewHolder) holder).upvoteButton.clearColorFilter(); + ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousDownvoteButtonColorFilter == null) { //Not downvoted before @@ -683,8 +691,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView //Downvoted before post.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - ((PostViewHolder) holder).downvoteButton.clearColorFilter(); - ((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); } ((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); } else { post.setVoteType(0); - ((PostViewHolder) holder).downvoteButton.clearColorFilter(); - ((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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())); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -1145,7 +1153,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView int previousVoteType = post.getVoteType(); String newVoteType; - ((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); + ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousUpvoteButtonColorFilter == null) { //Not upvoted before @@ -1158,8 +1166,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView //Upvoted before post.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - ((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); } ((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); } else { post.setVoteType(0); - ((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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())); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -1216,7 +1224,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView int previousVoteType = post.getVoteType(); String newVoteType; - ((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); + ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); if (previousDownvoteButtonColorFilter == null) { //Not downvoted before @@ -1229,8 +1237,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView //Downvoted before post.setVoteType(0); newVoteType = RedditUtils.DIR_UNVOTE; - ((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); - ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); } ((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); } else { post.setVoteType(0); - ((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); - ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); + ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((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())); 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).noPreviewLinkImageView.setVisibility(View.GONE); ((PostViewHolder) holder).contentTextView.setVisibility(View.GONE); - ((PostViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); - ((PostViewHolder) holder).downvoteButton.clearColorFilter(); + ((PostViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); + ((PostViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); } else if (holder instanceof PostCompactViewHolder) { mGlide.clear(((PostCompactViewHolder) holder).imageView); mGlide.clear(((PostCompactViewHolder) holder).iconGifImageView); @@ -1529,9 +1537,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE); - ((PostCompactViewHolder) holder).upvoteButton.clearColorFilter(); - ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mSecondaryTextColor); - ((PostCompactViewHolder) holder).downvoteButton.clearColorFilter(); + ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); + ((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); progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); 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); progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); 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); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java index 835a7db2..2ce1c90e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java @@ -110,9 +110,29 @@ public class CustomThemeWrapper { 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() { return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, - getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } public int getToolbarAndTabBackgroundColor() { @@ -265,11 +285,6 @@ public class CustomThemeWrapper { getDefaultColor("#00BA81", "#00BA81", "#00BA81")); } - public int getNotificationIconColor() { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NOTIFICATION_ICON_COLOR, - getDefaultColor("#1565C0", "#1565C0", "#1565C0")); - } - public int getSingleCommentThreadBackgroundColor() { return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND, getDefaultColor("#B3E5F9", "#123E77", "#123E77")); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 311c88c6..8c0b118e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -63,7 +63,7 @@ public class PullNotificationWorker extends Worker { public Result doWork() { try { List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts(); - int color = mCustomThemeWrapper.getNotificationIconColor(); + int color = mCustomThemeWrapper.getColorPrimaryLightTheme(); for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) { Account account = accounts.get(accountIndex); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java index cc851e99..cfce40c8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java @@ -130,7 +130,7 @@ public class SubmitPostService extends Service { .setContentTitle(getString(stringResId)) .setContentText(getString(R.string.please_wait)) .setSmallIcon(R.drawable.ic_notification) - .setColor(mCustomThemeWrapper.getNotificationIconColor()) + .setColor(mCustomThemeWrapper.getColorPrimaryLightTheme()) .build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java index a3f3695a..92d1a984 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java @@ -21,6 +21,10 @@ public class CustomThemeSharedPreferencesUtils { public static final String BACKGROUND_COLOR = "backgroundColor"; public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor"; 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_AND_TAB_BACKGROUND_COLOR = "toolbarAndTabBackgroundColor"; 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 SUBMITTER = "submitter"; 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 UNREAD_MESSAGE_BACKGROUND_COLOR = "unreadMessageBackgroundColor"; public static final String DIVIDER_COLOR = "dividerColor"; diff --git a/app/src/main/res/layout/item_nav_drawer_menu_item.xml b/app/src/main/res/layout/item_nav_drawer_menu_item.xml index 4e3cdf5b..6fcd0b35 100644 --- a/app/src/main/res/layout/item_nav_drawer_menu_item.xml +++ b/app/src/main/res/layout/item_nav_drawer_menu_item.xml @@ -1,12 +1,24 @@ <?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_height="wrap_content" - android:background="?attr/selectableItemBackground" + android:padding="16dp" android:clickable="true" - android:drawablePadding="32dp" android:focusable="true" - android:gravity="center_vertical" - android:padding="16dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" />
\ No newline at end of file + 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" /> + +</LinearLayout>
\ No newline at end of file |