mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-23 08:24:44 +01:00
Copying comments is now available. Some UI tweaks.
This commit is contained in:
parent
5e401a6a96
commit
ff5a60c827
@ -1,6 +1,5 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Adapter;
|
package ml.docilealligator.infinityforreddit.Adapter;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
@ -74,8 +73,8 @@ import ml.docilealligator.infinityforreddit.CommentData;
|
|||||||
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
|
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
|
||||||
import ml.docilealligator.infinityforreddit.CustomView.MarkwonLinearLayoutManager;
|
import ml.docilealligator.infinityforreddit.CustomView.MarkwonLinearLayoutManager;
|
||||||
import ml.docilealligator.infinityforreddit.FetchComment;
|
import ml.docilealligator.infinityforreddit.FetchComment;
|
||||||
|
import ml.docilealligator.infinityforreddit.Fragment.CommentMoreBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Fragment.CopyTextBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.Fragment.CopyTextBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Fragment.ModifyCommentBottomSheetFragment;
|
|
||||||
import ml.docilealligator.infinityforreddit.Fragment.ShareLinkBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.Fragment.ShareLinkBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||||
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
|
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
|
||||||
@ -721,7 +720,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
((CommentViewHolder) holder).commentTimeTextView.setText(comment.getCommentTime());
|
((CommentViewHolder) holder).commentTimeTextView.setText(comment.getCommentTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
mCommentMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentContent());
|
mCommentMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentMarkdown());
|
||||||
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
|
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
|
||||||
|
|
||||||
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 8, 0, 0, 0);
|
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 8, 0, 0, 0);
|
||||||
@ -761,24 +760,21 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
|
||||||
((CommentViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
|
Bundle bundle = new Bundle();
|
||||||
|
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||||
((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
|
}
|
||||||
Bundle bundle = new Bundle();
|
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
if (mIsSingleCommentThreadMode) {
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_CONTENT, comment.getCommentContent());
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 2);
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_FULLNAME, comment.getFullName());
|
} else {
|
||||||
if (mIsSingleCommentThreadMode) {
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
||||||
bundle.putInt(ModifyCommentBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 2);
|
}
|
||||||
} else {
|
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||||
bundle.putInt(ModifyCommentBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||||
}
|
commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||||
modifyCommentBottomSheetFragment.setArguments(bundle);
|
});
|
||||||
modifyCommentBottomSheetFragment.show(((AppCompatActivity) mActivity).getSupportFragmentManager(), modifyCommentBottomSheetFragment.getTag());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comment.hasReply()) {
|
if (comment.hasReply()) {
|
||||||
if (comment.isExpanded()) {
|
if (comment.isExpanded()) {
|
||||||
@ -838,7 +834,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
|
|
||||||
Intent intent = new Intent(mActivity, CommentActivity.class);
|
Intent intent = new Intent(mActivity, CommentActivity.class);
|
||||||
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
|
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
|
||||||
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, comment.getCommentContent());
|
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, comment.getCommentMarkdown());
|
||||||
intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, comment.getFullName());
|
intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, comment.getFullName());
|
||||||
intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, true);
|
intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, true);
|
||||||
|
|
||||||
@ -1007,7 +1003,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
((CommentViewHolder) holder).shareButton.setOnClickListener(view -> {
|
/*((CommentViewHolder) holder).shareButton.setOnClickListener(view -> {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
intent.setType("text/plain");
|
intent.setType("text/plain");
|
||||||
@ -1016,7 +1012,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(mActivity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
((CommentViewHolder) holder).expandButton.setOnClickListener(view -> {
|
((CommentViewHolder) holder).expandButton.setOnClickListener(view -> {
|
||||||
if (((CommentViewHolder) holder).expandButton.getVisibility() == View.VISIBLE) {
|
if (((CommentViewHolder) holder).expandButton.getVisibility() == View.VISIBLE) {
|
||||||
@ -1500,7 +1496,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void editComment(String commentContent, int position) {
|
public void editComment(String commentContent, int position) {
|
||||||
mVisibleComments.get(position).setCommentContent(commentContent);
|
mVisibleComments.get(position).setCommentMarkdown(commentContent);
|
||||||
if (mIsSingleCommentThreadMode) {
|
if (mIsSingleCommentThreadMode) {
|
||||||
notifyItemChanged(position + 2);
|
notifyItemChanged(position + 2);
|
||||||
} else {
|
} else {
|
||||||
@ -1512,7 +1508,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
if (mVisibleComments != null && position >= 0 && position < mVisibleComments.size()) {
|
if (mVisibleComments != null && position >= 0 && position < mVisibleComments.size()) {
|
||||||
if (mVisibleComments.get(position).hasReply()) {
|
if (mVisibleComments.get(position).hasReply()) {
|
||||||
mVisibleComments.get(position).setAuthor("[deleted]");
|
mVisibleComments.get(position).setAuthor("[deleted]");
|
||||||
mVisibleComments.get(position).setCommentContent("[deleted]");
|
mVisibleComments.get(position).setCommentMarkdown("[deleted]");
|
||||||
if (mIsSingleCommentThreadMode) {
|
if (mIsSingleCommentThreadMode) {
|
||||||
notifyItemChanged(position + 2);
|
notifyItemChanged(position + 2);
|
||||||
} else {
|
} else {
|
||||||
@ -1583,7 +1579,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mGlide.clear(((CommentViewHolder) holder).authorTypeImageView);
|
mGlide.clear(((CommentViewHolder) holder).authorTypeImageView);
|
||||||
((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).moreButton.setVisibility(View.GONE);
|
//((CommentViewHolder) holder).moreButton.setVisibility(View.GONE);
|
||||||
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
|
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
|
||||||
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
((CommentViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mActivity, R.color.defaultTextColor));
|
((CommentViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mActivity, R.color.defaultTextColor));
|
||||||
@ -1932,8 +1928,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
ImageView saveButton;
|
ImageView saveButton;
|
||||||
@BindView(R.id.expand_button_item_post_comment)
|
@BindView(R.id.expand_button_item_post_comment)
|
||||||
ImageView expandButton;
|
ImageView expandButton;
|
||||||
@BindView(R.id.share_button_item_post_comment)
|
|
||||||
ImageView shareButton;
|
|
||||||
@BindView(R.id.reply_button_item_post_comment)
|
@BindView(R.id.reply_button_item_post_comment)
|
||||||
ImageView replyButton;
|
ImageView replyButton;
|
||||||
@BindView(R.id.vertical_block_item_post_comment)
|
@BindView(R.id.vertical_block_item_post_comment)
|
||||||
@ -1952,16 +1946,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
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.clear(shareButton.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(moreButton.getId(), ConstraintSet.END, upVoteButton.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);
|
||||||
constraintSet.connect(replyButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END);
|
constraintSet.connect(replyButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
|
||||||
constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
|
|
||||||
constraintSet.setHorizontalBias(moreButton.getId(), 0);
|
constraintSet.setHorizontalBias(moreButton.getId(), 0);
|
||||||
constraintSet.applyTo(bottomConstraintLayout);
|
constraintSet.applyTo(bottomConstraintLayout);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Adapter;
|
package ml.docilealligator.infinityforreddit.Adapter;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -38,7 +37,7 @@ import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
|||||||
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
||||||
import ml.docilealligator.infinityforreddit.CommentData;
|
import ml.docilealligator.infinityforreddit.CommentData;
|
||||||
import ml.docilealligator.infinityforreddit.Fragment.ModifyCommentBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.Fragment.CommentMoreBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
import ml.docilealligator.infinityforreddit.SaveThing;
|
import ml.docilealligator.infinityforreddit.SaveThing;
|
||||||
@ -59,7 +58,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areContentsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
|
public boolean areContentsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
|
||||||
return commentData.getCommentContent().equals(t1.getCommentContent());
|
return commentData.getCommentMarkdown().equals(t1.getCommentMarkdown());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@ -157,7 +156,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
((DataViewHolder) holder).commentTimeTextView.setText(comment.getCommentTime());
|
((DataViewHolder) holder).commentTimeTextView.setText(comment.getCommentTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
mMarkwon.setMarkdown(((DataViewHolder) holder).commentMarkdownView, comment.getCommentContent());
|
mMarkwon.setMarkdown(((DataViewHolder) holder).commentMarkdownView, comment.getCommentMarkdown());
|
||||||
|
|
||||||
((DataViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
|
((DataViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
|
||||||
|
|
||||||
@ -174,19 +173,17 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comment.getAuthor().equals(mAccountName)) {
|
((DataViewHolder) holder).moreButton.setOnClickListener(view -> {
|
||||||
((DataViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
|
Bundle bundle = new Bundle();
|
||||||
((DataViewHolder) holder).moreButton.setOnClickListener(view -> {
|
if (comment.getAuthor().equals(mAccountName)) {
|
||||||
ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
Bundle bundle = new Bundle();
|
}
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_CONTENT, comment.getCommentContent());
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
||||||
bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_FULLNAME, comment.getFullName());
|
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||||
bundle.putInt(ModifyCommentBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||||
modifyCommentBottomSheetFragment.setArguments(bundle);
|
commentMoreBottomSheetFragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||||
modifyCommentBottomSheetFragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), modifyCommentBottomSheetFragment.getTag());
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
((DataViewHolder) holder).linearLayout.setOnClickListener(view -> {
|
((DataViewHolder) holder).linearLayout.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(mContext, ViewPostDetailActivity.class);
|
Intent intent = new Intent(mContext, ViewPostDetailActivity.class);
|
||||||
@ -200,17 +197,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
((DataViewHolder) holder).commentMarkdownView.setOnClickListener(view ->
|
((DataViewHolder) holder).commentMarkdownView.setOnClickListener(view ->
|
||||||
((DataViewHolder) holder).linearLayout.callOnClick());
|
((DataViewHolder) holder).linearLayout.callOnClick());
|
||||||
|
|
||||||
((DataViewHolder) holder).shareButton.setOnClickListener(view -> {
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
||||||
intent.setType("text/plain");
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, comment.getPermalink());
|
|
||||||
mContext.startActivity(Intent.createChooser(intent, mContext.getString(R.string.share)));
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Toast.makeText(mContext, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
((DataViewHolder) holder).replyButton.setVisibility(View.GONE);
|
((DataViewHolder) holder).replyButton.setVisibility(View.GONE);
|
||||||
|
|
||||||
((DataViewHolder) holder).upvoteButton.setOnClickListener(view -> {
|
((DataViewHolder) holder).upvoteButton.setOnClickListener(view -> {
|
||||||
@ -441,8 +427,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
ImageView saveButton;
|
ImageView saveButton;
|
||||||
@BindView(R.id.expand_button_item_post_comment)
|
@BindView(R.id.expand_button_item_post_comment)
|
||||||
ImageView expandButton;
|
ImageView expandButton;
|
||||||
@BindView(R.id.share_button_item_post_comment)
|
|
||||||
ImageView shareButton;
|
|
||||||
@BindView(R.id.reply_button_item_post_comment)
|
@BindView(R.id.reply_button_item_post_comment)
|
||||||
ImageView replyButton;
|
ImageView replyButton;
|
||||||
|
|
||||||
@ -457,18 +441,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
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(replyButton.getId(), ConstraintSet.END);
|
constraintSet.clear(replyButton.getId(), ConstraintSet.END);
|
||||||
constraintSet.clear(shareButton.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(moreButton.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.END);
|
constraintSet.connect(moreButton.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.END);
|
||||||
constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END);
|
constraintSet.connect(expandButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
|
||||||
constraintSet.connect(saveButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
|
constraintSet.connect(replyButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
|
||||||
constraintSet.connect(replyButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END);
|
|
||||||
constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
|
|
||||||
constraintSet.setHorizontalBias(moreButton.getId(), 0);
|
constraintSet.setHorizontalBias(moreButton.getId(), 0);
|
||||||
constraintSet.applyTo(bottomConstraintLayout);
|
constraintSet.applyTo(bottomConstraintLayout);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ public class CommentData implements Parcelable {
|
|||||||
private String linkAuthor;
|
private String linkAuthor;
|
||||||
private String commentTime;
|
private String commentTime;
|
||||||
private long commentTimeMillis;
|
private long commentTimeMillis;
|
||||||
private String commentContent;
|
private String commentMarkdown;
|
||||||
|
private String commentRawText;
|
||||||
private String linkId;
|
private String linkId;
|
||||||
private String subredditName;
|
private String subredditName;
|
||||||
private String parentId;
|
private String parentId;
|
||||||
@ -51,9 +52,10 @@ public class CommentData implements Parcelable {
|
|||||||
private boolean isLoadingMoreChildren;
|
private boolean isLoadingMoreChildren;
|
||||||
private boolean loadMoreChildrenFailed;
|
private boolean loadMoreChildrenFailed;
|
||||||
|
|
||||||
public CommentData(String id, String fullName, String author, String authorFlair, String linkAuthor, String commentTime,
|
public CommentData(String id, String fullName, String author, String authorFlair, String linkAuthor,
|
||||||
long commentTimeMillis, String commentContent, String linkId, String subredditName, String parentId, int score,
|
String commentTime, long commentTimeMillis, String commentMarkdown,
|
||||||
int voteType, boolean isSubmitter, String distinguished, String permalink,
|
String commentRawText, String linkId, String subredditName, String parentId,
|
||||||
|
int score, int voteType, boolean isSubmitter, String distinguished, String permalink,
|
||||||
int depth, boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved) {
|
int depth, boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
@ -62,7 +64,8 @@ public class CommentData implements Parcelable {
|
|||||||
this.linkAuthor = linkAuthor;
|
this.linkAuthor = linkAuthor;
|
||||||
this.commentTime = commentTime;
|
this.commentTime = commentTime;
|
||||||
this.commentTimeMillis = commentTimeMillis;
|
this.commentTimeMillis = commentTimeMillis;
|
||||||
this.commentContent = commentContent;
|
this.commentMarkdown = commentMarkdown;
|
||||||
|
this.commentRawText = commentRawText;
|
||||||
this.linkId = linkId;
|
this.linkId = linkId;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
this.parentId = parentId;
|
this.parentId = parentId;
|
||||||
@ -97,7 +100,8 @@ public class CommentData implements Parcelable {
|
|||||||
linkAuthor = in.readString();
|
linkAuthor = in.readString();
|
||||||
commentTime = in.readString();
|
commentTime = in.readString();
|
||||||
commentTimeMillis = in.readLong();
|
commentTimeMillis = in.readLong();
|
||||||
commentContent = in.readString();
|
commentMarkdown = in.readString();
|
||||||
|
commentRawText = in.readString();
|
||||||
linkId = in.readString();
|
linkId = in.readString();
|
||||||
subredditName = in.readString();
|
subredditName = in.readString();
|
||||||
parentId = in.readString();
|
parentId = in.readString();
|
||||||
@ -151,12 +155,20 @@ public class CommentData implements Parcelable {
|
|||||||
return commentTimeMillis;
|
return commentTimeMillis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommentContent() {
|
public String getCommentMarkdown() {
|
||||||
return commentContent;
|
return commentMarkdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommentContent(String commentContent) {
|
public void setCommentMarkdown(String commentMarkdown) {
|
||||||
this.commentContent = commentContent;
|
this.commentMarkdown = commentMarkdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommentRawText() {
|
||||||
|
return commentRawText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommentRawText(String commentRawText) {
|
||||||
|
this.commentRawText = commentRawText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLinkId() {
|
public String getLinkId() {
|
||||||
@ -328,7 +340,8 @@ public class CommentData implements Parcelable {
|
|||||||
parcel.writeString(linkAuthor);
|
parcel.writeString(linkAuthor);
|
||||||
parcel.writeString(commentTime);
|
parcel.writeString(commentTime);
|
||||||
parcel.writeLong(commentTimeMillis);
|
parcel.writeLong(commentTimeMillis);
|
||||||
parcel.writeString(commentContent);
|
parcel.writeString(commentMarkdown);
|
||||||
|
parcel.writeString(commentRawText);
|
||||||
parcel.writeString(linkId);
|
parcel.writeString(linkId);
|
||||||
parcel.writeString(subredditName);
|
parcel.writeString(subredditName);
|
||||||
parcel.writeString(parentId);
|
parcel.writeString(parentId);
|
||||||
|
@ -0,0 +1,130 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.Fragment;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.CommentData;
|
||||||
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
*/
|
||||||
|
public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static final String EXTRA_COMMENT = "ECF";
|
||||||
|
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
||||||
|
public static final String EXTRA_POSITION = "EP";
|
||||||
|
@BindView(R.id.edit_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView editTextView;
|
||||||
|
@BindView(R.id.delete_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView deleteTextView;
|
||||||
|
@BindView(R.id.save_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView shareTextView;
|
||||||
|
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView copyTextView;
|
||||||
|
private AppCompatActivity activity;
|
||||||
|
public CommentMoreBottomSheetFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View rootView = inflater.inflate(R.layout.fragment_comment_more_bottom_sheet, container, false);
|
||||||
|
ButterKnife.bind(this, rootView);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bundle bundle = getArguments();
|
||||||
|
CommentData commentData = bundle.getParcelable(EXTRA_COMMENT);
|
||||||
|
if (commentData == null) {
|
||||||
|
dismiss();
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN);
|
||||||
|
|
||||||
|
if (accessToken != null && !accessToken.equals("")) {
|
||||||
|
editTextView.setVisibility(View.VISIBLE);
|
||||||
|
deleteTextView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
editTextView.setOnClickListener(view -> {
|
||||||
|
Intent intent = new Intent(activity, EditCommentActivity.class);
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_ACCESS_TOKEN, accessToken);
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, commentData.getFullName());
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, commentData.getCommentMarkdown());
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
|
||||||
|
if (activity instanceof ViewPostDetailActivity) {
|
||||||
|
activity.startActivityForResult(intent, ViewPostDetailActivity.EDIT_COMMENT_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteTextView.setOnClickListener(view -> {
|
||||||
|
dismiss();
|
||||||
|
if (activity instanceof ViewPostDetailActivity) {
|
||||||
|
((ViewPostDetailActivity) activity).deleteComment(commentData.getFullName(), bundle.getInt(EXTRA_POSITION));
|
||||||
|
} else if (activity instanceof ViewUserDetailActivity) {
|
||||||
|
((ViewUserDetailActivity) activity).deleteComment(commentData.getFullName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
shareTextView.setOnClickListener(view -> {
|
||||||
|
dismiss();
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, commentData.getPermalink());
|
||||||
|
activity.startActivity(Intent.createChooser(intent, getString(R.string.share)));
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(activity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
copyTextView.setOnClickListener(view -> {
|
||||||
|
dismiss();
|
||||||
|
CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
|
||||||
|
Bundle copyBundle = new Bundle();
|
||||||
|
copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, commentData.getCommentMarkdown());
|
||||||
|
copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, commentData.getCommentRawText());
|
||||||
|
copyTextBottomSheetFragment.setArguments(copyBundle);
|
||||||
|
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
|
||||||
|
});
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
activity = (AppCompatActivity) context;
|
||||||
|
}
|
||||||
|
}
|
@ -1,88 +0,0 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Fragment;
|
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple {@link Fragment} subclass.
|
|
||||||
*/
|
|
||||||
public class ModifyCommentBottomSheetFragment extends RoundedBottomSheetDialogFragment {
|
|
||||||
|
|
||||||
public static final String EXTRA_COMMENT_FULLNAME = "ECF";
|
|
||||||
public static final String EXTRA_COMMENT_CONTENT = "ECC";
|
|
||||||
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
|
||||||
public static final String EXTRA_POSITION = "EP";
|
|
||||||
@BindView(R.id.edit_text_view_modify_comment_bottom_sheet_fragment)
|
|
||||||
TextView editTextView;
|
|
||||||
@BindView(R.id.delete_text_view_modify_comment_bottom_sheet_fragment)
|
|
||||||
TextView deleteTextView;
|
|
||||||
public ModifyCommentBottomSheetFragment() {
|
|
||||||
// Required empty public constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_modify_comment_bottom_sheet, container, false);
|
|
||||||
ButterKnife.bind(this, rootView);
|
|
||||||
|
|
||||||
Activity activity = getActivity();
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
|
||||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
|
||||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle bundle = getArguments();
|
|
||||||
String fullName = bundle.getString(EXTRA_COMMENT_FULLNAME);
|
|
||||||
String content = bundle.getString(EXTRA_COMMENT_CONTENT);
|
|
||||||
String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN);
|
|
||||||
|
|
||||||
editTextView.setOnClickListener(view -> {
|
|
||||||
Intent intent = new Intent(activity, EditCommentActivity.class);
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_ACCESS_TOKEN, accessToken);
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, fullName);
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, content);
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
|
|
||||||
if (activity instanceof ViewPostDetailActivity) {
|
|
||||||
activity.startActivityForResult(intent, ViewPostDetailActivity.EDIT_COMMENT_REQUEST_CODE);
|
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
deleteTextView.setOnClickListener(view -> {
|
|
||||||
dismiss();
|
|
||||||
if (activity instanceof ViewPostDetailActivity) {
|
|
||||||
((ViewPostDetailActivity) activity).deleteComment(fullName, bundle.getInt(EXTRA_POSITION));
|
|
||||||
} else if (activity instanceof ViewUserDetailActivity) {
|
|
||||||
((ViewUserDetailActivity) activity).deleteComment(fullName);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -127,10 +127,12 @@ public class ParseComment {
|
|||||||
String parentId = singleCommentData.getString(JSONUtils.PARENT_ID_KEY);
|
String parentId = singleCommentData.getString(JSONUtils.PARENT_ID_KEY);
|
||||||
boolean isSubmitter = singleCommentData.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
|
boolean isSubmitter = singleCommentData.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
|
||||||
String distinguished = singleCommentData.getString(JSONUtils.DISTINGUISHED_KEY);
|
String distinguished = singleCommentData.getString(JSONUtils.DISTINGUISHED_KEY);
|
||||||
String commentContent = "";
|
String commentMarkdown = "";
|
||||||
if (!singleCommentData.isNull(JSONUtils.BODY_KEY)) {
|
if (!singleCommentData.isNull(JSONUtils.BODY_KEY)) {
|
||||||
commentContent = Utils.modifyMarkdown(singleCommentData.getString(JSONUtils.BODY_KEY).trim());
|
commentMarkdown = Utils.modifyMarkdown(singleCommentData.getString(JSONUtils.BODY_KEY).trim());
|
||||||
}
|
}
|
||||||
|
String commentRawText = Utils.trimTrailingWhitespace(
|
||||||
|
Html.fromHtml(singleCommentData.getString(JSONUtils.BODY_HTML_KEY))).toString();
|
||||||
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_KEY)).toString();
|
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_KEY)).toString();
|
||||||
int score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
|
int score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
|
||||||
int voteType;
|
int voteType;
|
||||||
@ -157,8 +159,9 @@ public class ParseComment {
|
|||||||
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
|
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
|
||||||
|
|
||||||
return new CommentData(id, fullName, author, authorFlair, linkAuthor, formattedSubmitTime,
|
return new CommentData(id, fullName, author, authorFlair, linkAuthor, formattedSubmitTime,
|
||||||
submitTime, commentContent, linkId, subredditName, parentId, score, voteType,
|
submitTime, commentMarkdown, commentRawText, linkId, subredditName, parentId, score,
|
||||||
isSubmitter, distinguished, permalink, depth, collapsed, hasReply, scoreHidden, saved);
|
voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply,
|
||||||
|
scoreHidden, saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -43,6 +43,7 @@ public class JSONUtils {
|
|||||||
public static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview";
|
public static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview";
|
||||||
public static final String STICKIED_KEY = "stickied";
|
public static final String STICKIED_KEY = "stickied";
|
||||||
public static final String BODY_KEY = "body";
|
public static final String BODY_KEY = "body";
|
||||||
|
public static final String BODY_HTML_KEY = "body_html";
|
||||||
public static final String COLLAPSED_KEY = "collapsed";
|
public static final String COLLAPSED_KEY = "collapsed";
|
||||||
public static final String IS_SUBMITTER_KEY = "is_submitter";
|
public static final String IS_SUBMITTER_KEY = "is_submitter";
|
||||||
public static final String REPLIES_KEY = "replies";
|
public static final String REPLIES_KEY = "replies";
|
||||||
|
9
app/src/main/res/drawable-night/ic_delete_24dp.xml
Normal file
9
app/src/main/res/drawable-night/ic_delete_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M14.12,10.47L12,12.59l-2.13,-2.12 -1.41,1.41L10.59,14l-2.12,2.12 1.41,1.41L12,15.41l2.12,2.12 1.41,-1.41L13.41,14l2.12,-2.12zM15.5,4l-1,-1h-5l-1,1H5v2h14V4zM6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM8,9h8v10H8V9z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-night/ic_edit_24dp.xml
Normal file
9
app/src/main/res/drawable-night/ic_edit_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M14.06,9.02l0.92,0.92L5.92,19L5,19v-0.92l9.06,-9.06M17.66,3c-0.25,0 -0.51,0.1 -0.7,0.29l-1.83,1.83 3.75,3.75 1.83,-1.83c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.2,-0.2 -0.45,-0.29 -0.71,-0.29zM14.06,6.19L3,17.25L3,21h3.75L17.81,9.94l-3.75,-3.75z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-night/ic_share_24dp.xml
Normal file
9
app/src/main/res/drawable-night/ic_share_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_delete_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_delete_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M14.12,10.47L12,12.59l-2.13,-2.12 -1.41,1.41L10.59,14l-2.12,2.12 1.41,1.41L12,15.41l2.12,2.12 1.41,-1.41L13.41,14l2.12,-2.12zM15.5,4l-1,-1h-5l-1,1H5v2h14V4zM6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM8,9h8v10H8V9z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_edit_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_edit_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M14.06,9.02l0.92,0.92L5.92,19L5,19v-0.92l9.06,-9.06M17.66,3c-0.25,0 -0.51,0.1 -0.7,0.29l-1.83,1.83 3.75,3.75 1.83,-1.83c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.2,-0.2 -0.45,-0.29 -0.71,-0.29zM14.06,6.19L3,17.25L3,21h3.75L17.81,9.94l-3.75,-3.75z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_share_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_share_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/>
|
||||||
|
</vector>
|
@ -0,0 +1,86 @@
|
|||||||
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/edit_text_view_comment_more_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableStart="@drawable/ic_edit_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:text="@string/edit"
|
||||||
|
android:textColor="@color/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/delete_text_view_comment_more_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableStart="@drawable/ic_delete_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:text="@string/delete"
|
||||||
|
android:textColor="@color/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/save_text_view_comment_more_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableStart="@drawable/ic_share_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:text="@string/share"
|
||||||
|
android:textColor="@color/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/copy_text_view_comment_more_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableStart="@drawable/ic_copy_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:text="@string/copy_text"
|
||||||
|
android:textColor="@color/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".Fragment.ModifyCommentBottomSheetFragment">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/edit_text_view_modify_comment_bottom_sheet_fragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:paddingStart="32dp"
|
|
||||||
android:paddingEnd="32dp"
|
|
||||||
android:text="@string/edit"
|
|
||||||
android:textColor="@color/primaryTextColor"
|
|
||||||
android:textSize="?attr/font_default"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:background="?attr/selectableItemBackground" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/delete_text_view_modify_comment_bottom_sheet_fragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:paddingStart="32dp"
|
|
||||||
android:paddingEnd="32dp"
|
|
||||||
android:text="@string/delete"
|
|
||||||
android:textColor="@color/primaryTextColor"
|
|
||||||
android:textSize="?attr/font_default"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:background="?attr/selectableItemBackground" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -154,7 +154,6 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:src="@drawable/ic_more_vert_grey_24dp"
|
android:src="@drawable/ic_more_vert_grey_24dp"
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment"
|
app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
@ -198,11 +197,11 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:src="@drawable/ic_reply_grey_24dp"
|
android:src="@drawable/ic_reply_grey_24dp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_comment"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
<ImageView
|
<!--<ImageView
|
||||||
android:id="@+id/share_button_item_post_comment"
|
android:id="@+id/share_button_item_post_comment"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -214,7 +213,7 @@
|
|||||||
android:src="@drawable/ic_share_grey_24dp"
|
android:src="@drawable/ic_share_grey_24dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>-->
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -411,4 +411,7 @@
|
|||||||
<string name="copy_raw_text">Copy Raw Text</string>
|
<string name="copy_raw_text">Copy Raw Text</string>
|
||||||
<string name="copy_all_markdown">Copy All Markdown</string>
|
<string name="copy_all_markdown">Copy All Markdown</string>
|
||||||
<string name="copy_all_raw_text">Copy All Raw Text</string>
|
<string name="copy_all_raw_text">Copy All Raw Text</string>
|
||||||
|
|
||||||
|
<string name="save_comment">Save comment</string>
|
||||||
|
<string name="unsave_comment">Unsave comment</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user