diff options
Diffstat (limited to 'app/src/main/java')
2 files changed, 33 insertions, 42 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index bebeb505..411a8af0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.graphics.Color; -import android.graphics.PorterDuff; import android.net.Uri; import android.os.Bundle; import android.text.Spanned; @@ -12,7 +11,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; @@ -243,9 +241,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment } if (comment.isSaved()) { - ((CommentBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + ((CommentBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } else { - ((CommentBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + ((CommentBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } } } @@ -360,10 +358,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment MaterialButton upvoteButton; MaterialButton downvoteButton; View placeholder; - ImageView moreButton; - ImageView saveButton; - TextView expandButton; - ImageView replyButton; + MaterialButton moreButton; + MaterialButton saveButton; + MaterialButton replyButton; View commentDivider; CustomMarkwonAdapter markwonAdapter; @@ -382,10 +379,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment MaterialButton upvoteButton, MaterialButton downvoteButton, View placeholder, - ImageView moreButton, - ImageView saveButton, + MaterialButton moreButton, + MaterialButton saveButton, TextView expandButton, - ImageView replyButton, + MaterialButton replyButton, CommentIndentationView commentIndentationView, View commentDivider) { this.linearLayout = linearLayout; @@ -401,7 +398,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment this.placeholder = placeholder; this.moreButton = moreButton; this.saveButton = saveButton; - this.expandButton = expandButton; this.replyButton = replyButton; this.commentDivider = commentDivider; @@ -460,9 +456,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); upvoteButton.setTextColor(mCommentIconAndInfoColor); downvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); - moreButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); - saveButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); - replyButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); + moreButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); + saveButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); + replyButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); commentDivider.setBackgroundColor(mDividerColor); authorTextView.setOnClickListener(view -> { @@ -701,7 +697,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment public void success() { comment.setSaved(false); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show(); } @@ -710,7 +706,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment public void failed() { comment.setSaved(true); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show(); } @@ -722,7 +718,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment public void success() { comment.setSaved(true); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show(); } @@ -731,7 +727,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment public void failed() { comment.setSaved(false); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 26b00bb2..ac4653b4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.graphics.Color; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; @@ -504,24 +503,20 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi } if (mPost.isArchived()) { - ((CommentBaseViewHolder) holder).replyButton - .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, - PorterDuff.Mode.SRC_IN); + ((CommentBaseViewHolder) holder).replyButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); ((CommentBaseViewHolder) holder).upvoteButton.setTextColor(mVoteAndReplyUnavailableVoteButtonColor); ((CommentBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); ((CommentBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); } if (mPost.isLocked()) { - ((CommentBaseViewHolder) holder).replyButton - .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, - PorterDuff.Mode.SRC_IN); + ((CommentBaseViewHolder) holder).replyButton.setIconTint(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); } if (comment.isSaved()) { - ((CommentBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + ((CommentBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } else { - ((CommentBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + ((CommentBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } if (position == mSearchCommentIndex) { @@ -1134,7 +1129,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi ((CommentBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); ((CommentBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); ((CommentBaseViewHolder) holder).expandButton.setText(""); - ((CommentBaseViewHolder) holder).replyButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); + ((CommentBaseViewHolder) holder).replyButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams(); params.setMargins(0, 0, 0, 0); } @@ -1184,10 +1179,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi MaterialButton upvoteButton; MaterialButton downvoteButton; View placeholder; - ImageView moreButton; - ImageView saveButton; + MaterialButton moreButton; + MaterialButton saveButton; TextView expandButton; - ImageView replyButton; + MaterialButton replyButton; CommentIndentationView commentIndentationView; View commentDivider; CustomMarkwonAdapter mMarkwonAdapter; @@ -1210,10 +1205,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi MaterialButton upvoteButton, MaterialButton downvoteButton, View placeholder, - ImageView moreButton, - ImageView saveButton, + MaterialButton moreButton, + MaterialButton saveButton, TextView expandButton, - ImageView replyButton, + MaterialButton replyButton, CommentIndentationView commentIndentationView, View commentDivider) { this.linearLayout = linearLayout; @@ -1320,10 +1315,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); upvoteButton.setTextColor(mCommentIconAndInfoColor); downvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); - moreButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); + moreButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); expandButton.setTextColor(mCommentIconAndInfoColor); - saveButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); - replyButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN); + saveButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); + replyButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); authorFlairTextView.setOnClickListener(view -> authorTextView.performClick()); @@ -1577,7 +1572,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi public void success() { comment.setSaved(false); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show(); } @@ -1586,7 +1581,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi public void failed() { comment.setSaved(true); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show(); } @@ -1598,7 +1593,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi public void success() { comment.setSaved(true); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show(); } @@ -1607,7 +1602,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi public void failed() { comment.setSaved(false); if (getBindingAdapterPosition() == position) { - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show(); } |