mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2026-04-28 17:56:34 +00:00
Use MaterialButton for icons in comments.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -204,20 +204,19 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/vote_button_toggle_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/more_button_item_post_comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_more_vert_grey_24dp"
|
||||
app:strokeWidth="0dp"
|
||||
app:icon="@drawable/ic_more_vert_grey_24dp"
|
||||
app:iconSize="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/placeholder_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="?attr/materialIconButtonOutlinedStyle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/expand_button_item_post_comment"
|
||||
@ -238,34 +237,32 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/more_button_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/save_button_item_post_comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="8dp"
|
||||
app:strokeWidth="0dp"
|
||||
app:iconSize="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/expand_button_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="?attr/materialIconButtonOutlinedStyle" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/reply_button_item_post_comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_reply_grey_24dp"
|
||||
app:strokeWidth="0dp"
|
||||
app:icon="@drawable/ic_reply_grey_24dp"
|
||||
app:iconSize="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/save_button_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="?attr/materialIconButtonOutlinedStyle" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user