aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java78
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java31
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java137
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java84
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java31
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java28
-rw-r--r--app/src/main/res/drawable/ic_outline_more_vert_24px.xml9
-rw-r--r--app/src/main/res/layout/activity_edit_comment.xml37
-rw-r--r--app/src/main/res/layout/fragment_modify_comment_bottom_sheet.xml38
-rw-r--r--app/src/main/res/layout/fragment_post_type_bottom_sheet.xml1
-rw-r--r--app/src/main/res/layout/item_comment.xml111
-rw-r--r--app/src/main/res/menu/edit_comment_activity.xml10
-rw-r--r--app/src/main/res/values/strings.xml2
17 files changed, 578 insertions, 37 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d8853f50..3679f066 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,6 +21,11 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
+ android:name=".EditCommentActivity"
+ android:parentActivityName=".MainActivity"
+ android:theme="@style/AppTheme.NoActionBar"
+ android:windowSoftInputMode="adjustResize" />
+ <activity
android:name=".EditPostActivity"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index d77f2397..95c16c0a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -32,4 +32,5 @@ interface AppComponent {
void inject(FollowedUsersListingFragment followedUsersListingFragment);
void inject(SubredditSelectionActivity subredditSelectionActivity);
void inject(EditPostActivity editPostActivity);
+ void inject(EditCommentActivity editCommentActivity);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
index 25005db0..45474c64 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
@@ -6,6 +6,7 @@ import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -19,6 +20,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
@@ -61,6 +63,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
private RedditDataRoomDatabase mRedditDataRoomDatabase;
private RequestManager mGlide;
private String mAccessToken;
+ private String mAccountName;
private Post mPost;
private ArrayList<CommentData> mVisibleComments;
private String mSubredditNamePrefixed;
@@ -79,7 +82,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
CommentAndPostRecyclerViewAdapter(Activity activity, Retrofit retrofit, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
- String accessToken, Post post, String subredditNamePrefixed,
+ String accessToken, String accountName, Post post, String subredditNamePrefixed,
Locale locale, LoadSubredditIconAsyncTask loadSubredditIconAsyncTask,
CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) {
mActivity = activity;
@@ -88,6 +91,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
mRedditDataRoomDatabase = redditDataRoomDatabase;
mGlide = glide;
mAccessToken = accessToken;
+ mAccountName = accountName;
mPost = post;
mVisibleComments = new ArrayList<>();
mSubredditNamePrefixed = subredditNamePrefixed;
@@ -425,6 +429,20 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
params.width = comment.getDepth() * 16;
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
+ if(comment.getAuthor().equals(mAccountName)) {
+ ((CommentViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
+ ((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
+ ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_CONTENT, comment.getCommentContent());
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_FULLNAME, comment.getFullName());
+ bundle.putInt(ModifyCommentBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
+ modifyCommentBottomSheetFragment.setArguments(bundle);
+ modifyCommentBottomSheetFragment.show(((AppCompatActivity) mActivity).getSupportFragmentManager(), modifyCommentBottomSheetFragment.getTag());
+ });
+ }
+
if (comment.hasReply()) {
if(comment.isExpanded()) {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
@@ -436,11 +454,11 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
switch (comment.getVoteType()) {
case 1:
- ((CommentViewHolder) holder).upvoteButton
+ ((CommentViewHolder) holder).upVoteButton
.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
break;
case 2:
- ((CommentViewHolder) holder).downvoteButton
+ ((CommentViewHolder) holder).downVoteButton
.setColorFilter(ContextCompat.getColor(mActivity, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
break;
}
@@ -638,12 +656,29 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
return mVisibleComments;
}
+ void editComment(String commentContent, int position) {
+ mVisibleComments.get(position).setCommentContent(commentContent);
+ notifyItemChanged(position + 1);
+ }
+
+ void deleteComment(int position) {
+ if(mVisibleComments.get(position).hasReply()) {
+ mVisibleComments.get(position).setAuthor("[deleted]");
+ mVisibleComments.get(position).setCommentContent("[deleted]");
+ notifyItemChanged(position + 1);
+ } else {
+ mVisibleComments.remove(position);
+ notifyItemRemoved(position + 1);
+ }
+ }
+
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof CommentViewHolder) {
+ ((CommentViewHolder) holder).moreButton.setVisibility(View.GONE);
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
- ((CommentViewHolder) holder).upvoteButton.clearColorFilter();
- ((CommentViewHolder) holder).downvoteButton.clearColorFilter();
+ ((CommentViewHolder) holder).upVoteButton.clearColorFilter();
+ ((CommentViewHolder) holder).downVoteButton.clearColorFilter();
}
}
@@ -854,9 +889,10 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
@BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
@BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment) CustomMarkwonView commentMarkdownView;
- @BindView(R.id.plus_button_item_post_comment) ImageView upvoteButton;
+ @BindView(R.id.up_vote_button_item_post_comment) ImageView upVoteButton;
@BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_comment) ImageView downvoteButton;
+ @BindView(R.id.down_vote_button_item_post_comment) ImageView downVoteButton;
+ @BindView(R.id.more_button_item_post_comment) ImageView moreButton;
@BindView(R.id.expand_button_item_post_comment) ImageView expandButton;
@BindView(R.id.share_button_item_post_comment) ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
@@ -906,7 +942,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
mActivity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE);
});
- upvoteButton.setOnClickListener(view -> {
+ upVoteButton.setOnClickListener(view -> {
if(mAccessToken == null) {
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
@@ -915,18 +951,18 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
int previousVoteType = mVisibleComments.get(getAdapterPosition() - 1).getVoteType();
String newVoteType;
- downvoteButton.clearColorFilter();
+ downVoteButton.clearColorFilter();
if(previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
//Not upvoted before
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
newVoteType = RedditUtils.DIR_UPVOTE;
- upvoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
+ upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
} else {
//Upvoted before
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE;
- upvoteButton.clearColorFilter();
+ upVoteButton.clearColorFilter();
}
scoreTextView.setText(Integer.toString(mVisibleComments.get(getAdapterPosition() - 1).getScore() + mVisibleComments.get(getAdapterPosition() - 1).getVoteType()));
@@ -936,13 +972,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
public void onVoteThingSuccess(int position) {
if(newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
- upvoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
+ upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
} else {
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
- upvoteButton.clearColorFilter();
+ upVoteButton.clearColorFilter();
}
- downvoteButton.clearColorFilter();
+ downVoteButton.clearColorFilter();
scoreTextView.setText(Integer.toString(mVisibleComments.get(getAdapterPosition() - 1).getScore() + mVisibleComments.get(getAdapterPosition() - 1).getVoteType()));
}
@@ -951,7 +987,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
}, mVisibleComments.get(getAdapterPosition() - 1).getFullName(), newVoteType, getAdapterPosition());
});
- downvoteButton.setOnClickListener(view -> {
+ downVoteButton.setOnClickListener(view -> {
if(mAccessToken == null) {
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
@@ -960,18 +996,18 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
int previousVoteType = mVisibleComments.get(getAdapterPosition() - 1).getVoteType();
String newVoteType;
- upvoteButton.clearColorFilter();
+ upVoteButton.clearColorFilter();
if(previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
//Not downvoted before
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
newVoteType = RedditUtils.DIR_DOWNVOTE;
- downvoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
+ downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
} else {
//Downvoted before
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
newVoteType = RedditUtils.DIR_UNVOTE;
- downvoteButton.clearColorFilter();
+ downVoteButton.clearColorFilter();
}
scoreTextView.setText(Integer.toString(mVisibleComments.get(getAdapterPosition() - 1).getScore() + mVisibleComments.get(getAdapterPosition() - 1).getVoteType()));
@@ -981,13 +1017,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
public void onVoteThingSuccess(int position1) {
if(newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
- downvoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
+ downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
} else {
mVisibleComments.get(getAdapterPosition() - 1).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
- downvoteButton.clearColorFilter();
+ downVoteButton.clearColorFilter();
}
- upvoteButton.clearColorFilter();
+ upVoteButton.clearColorFilter();
scoreTextView.setText(Integer.toString(mVisibleComments.get(getAdapterPosition() - 1).getScore() + mVisibleComments.get(getAdapterPosition() - 1).getVoteType()));
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
index c50e51df..595ac06c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
@@ -116,6 +116,10 @@ class CommentData implements Parcelable {
return author;
}
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
public String getCommentTime() {
return commentTime;
}
@@ -124,6 +128,10 @@ class CommentData implements Parcelable {
return commentContent;
}
+ public void setCommentContent(String commentContent) {
+ this.commentContent = commentContent;
+ }
+
public String getLinkId() {
return linkId;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java
index 63eefa89..56e3e7e8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java
@@ -40,6 +40,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
static final String EXTRA_USERNAME_KEY = "ENK";
static final String EXTRA_ACCESS_TOKEN = "EAT";
+ static final String EXTRA_ACCOUNT_NAME = "EAN";
@BindView(R.id.coordinator_layout_comments_listing_fragment) CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_comments_listing_fragment) RecyclerView mCommentRecyclerView;
@@ -93,7 +94,8 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
mCommentRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
mAdapter = new CommentsListingRecyclerViewAdapter(activity, mOauthRetrofit,
- getArguments().getString(EXTRA_ACCESS_TOKEN), () -> mCommentViewModel.retryLoadingMore());
+ getArguments().getString(EXTRA_ACCESS_TOKEN), getArguments().getString(EXTRA_ACCOUNT_NAME),
+ () -> mCommentViewModel.retryLoadingMore());
String username = getArguments().getString(EXTRA_USERNAME_KEY);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java
index e2fd34b5..ffcf707b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java
@@ -2,17 +2,18 @@ package ml.docilealligator.infinityforreddit;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
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.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.paging.PagedListAdapter;
import androidx.recyclerview.widget.DiffUtil;
@@ -27,6 +28,7 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R
private Context mContext;
private Retrofit mOauthRetrofit;
private String mAccessToken;
+ private String mAccountName;
private int mTextColorPrimaryDark;
private int mColorAccent;
@@ -42,11 +44,12 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R
}
protected CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken,
- RetryLoadingMoreCallback retryLoadingMoreCallback) {
+ String accountName, RetryLoadingMoreCallback retryLoadingMoreCallback) {
super(DIFF_CALLBACK);
mContext = context;
mOauthRetrofit = oauthRetrofit;
mAccessToken = accessToken;
+ mAccountName = accountName;
mRetryLoadingMoreCallback = retryLoadingMoreCallback;
mTextColorPrimaryDark = mContext.getResources().getColor(R.color.colorPrimaryDarkDayNightTheme);
mColorAccent = mContext.getResources().getColor(R.color.colorAccent);
@@ -114,6 +117,20 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R
.setColorFilter(ContextCompat.getColor(mContext, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
break;
}
+
+ if(comment.getAuthor().equals(mAccountName)) {
+ ((DataViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
+ ((DataViewHolder) holder).moreButton.setOnClickListener(view -> {
+ ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_CONTENT, comment.getCommentContent());
+ bundle.putString(ModifyCommentBottomSheetFragment.EXTRA_COMMENT_FULLNAME, comment.getFullName());
+ bundle.putInt(ModifyCommentBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
+ modifyCommentBottomSheetFragment.setArguments(bundle);
+ modifyCommentBottomSheetFragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), modifyCommentBottomSheetFragment.getTag());
+ });
+ }
}
}
@@ -165,9 +182,10 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R
@BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
@BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment) CustomMarkwonView commentMarkdownView;
- @BindView(R.id.plus_button_item_post_comment) ImageView upvoteButton;
+ @BindView(R.id.up_vote_button_item_post_comment) ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_comment) ImageView downvoteButton;
+ @BindView(R.id.down_vote_button_item_post_comment) ImageView downvoteButton;
+ @BindView(R.id.more_button_item_post_comment) ImageView moreButton;
@BindView(R.id.share_button_item_post_comment) ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
@@ -185,11 +203,6 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R
commentMarkdownView.setOnClickListener(view -> linearLayout.callOnClick());
- RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) shareButton.getLayoutParams();
- lp.addRule(RelativeLayout.ALIGN_PARENT_END);
- lp.setMarginEnd(0);
- shareButton.setLayoutParams(lp);
-
shareButton.setOnClickListener(view -> {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
new file mode 100644
index 00000000..11e30fd8
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
@@ -0,0 +1,137 @@
+package ml.docilealligator.infinityforreddit;
+
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.core.content.ContextCompat;
+
+import com.google.android.material.snackbar.Snackbar;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+import retrofit2.Retrofit;
+
+public class EditCommentActivity extends AppCompatActivity {
+
+ static final String EXTRA_CONTENT = "EC";
+ static final String EXTRA_FULLNAME = "EF";
+ static final String EXTRA_ACCESS_TOKEN = "EAT";
+ static final String EXTRA_POSITION = "EP";
+
+ static final String EXTRA_EDITED_COMMENT_CONTENT = "EECC";
+ static final String EXTRA_EDITED_COMMENT_POSITION = "EECP";
+
+ @BindView(R.id.coordinator_layout_edit_comment_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.toolbar_edit_comment_activity) Toolbar toolbar;
+ @BindView(R.id.post_text_content_edit_text_edit_comment_activity) EditText contentEditText;
+
+ private String mFullName;
+ private String mAccessToken;
+ private boolean isSubmitting = false;
+
+ @Inject
+ @Named("oauth")
+ Retrofit mOauthRetrofit;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_edit_comment);
+
+ ButterKnife.bind(this);
+
+ ((Infinity) getApplication()).getAppComponent().inject(this);
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ Window window = getWindow();
+ if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ }
+ window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
+ }
+
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ mFullName = getIntent().getExtras().getString(EXTRA_FULLNAME);
+ mAccessToken = getIntent().getExtras().getString(EXTRA_ACCESS_TOKEN);
+ contentEditText.setText(getIntent().getExtras().getString(EXTRA_CONTENT));
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.edit_comment_activity, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ if(item.getItemId() == R.id.action_send_edit_comment_activity) {
+ if(!isSubmitting) {
+ isSubmitting = true;
+
+ Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_SHORT).show();
+
+ String content = contentEditText.getText().toString();
+
+ Map<String, String> params = new HashMap<>();
+ params.put(RedditUtils.THING_ID_KEY, mFullName);
+ params.put(RedditUtils.TEXT_KEY, content);
+
+ mOauthRetrofit.create(RedditAPI.class)
+ .editPostOrComment(RedditUtils.getOAuthHeader(mAccessToken), params)
+ .enqueue(new Callback<String>() {
+ @Override
+ public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
+ isSubmitting = false;
+ if(response.isSuccessful()) {
+ Toast.makeText(EditCommentActivity.this, R.string.edit_success, Toast.LENGTH_SHORT).show();
+
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(EXTRA_EDITED_COMMENT_CONTENT, content);
+ returnIntent.putExtra(EXTRA_EDITED_COMMENT_POSITION, getIntent().getExtras().getInt(EXTRA_POSITION));
+ setResult(RESULT_OK, returnIntent);
+
+ finish();
+ } else {
+ Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
+ }
+ }
+
+ @Override
+ public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
+ isSubmitting = false;
+ Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
+ }
+ });
+
+ }
+ return true;
+ } else if(item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java
new file mode 100644
index 00000000..5b19cfaf
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java
@@ -0,0 +1,84 @@
+package ml.docilealligator.infinityforreddit;
+
+
+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;
+
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class ModifyCommentBottomSheetFragment extends RoundedBottomSheetDialogFragment {
+
+ static final String EXTRA_COMMENT_FULLNAME = "ECF";
+ static final String EXTRA_COMMENT_CONTENT = "ECC";
+ static final String EXTRA_ACCESS_TOKEN = "EAT";
+ static final String EXTRA_POSITION = "EP";
+
+ public ModifyCommentBottomSheetFragment() {
+ // Required empty public constructor
+ }
+
+ @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;
+
+ @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(getActivity(), 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;
+ }
+
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
index ad65fe4f..797c1834 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
@@ -59,6 +59,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
static final String EXTRA_POST_ID = "EPI";
private static final int EDIT_POST_REQUEST_CODE = 2;
+ static final int EDIT_COMMENT_REQUEST_CODE = 3;
private RequestManager mGlide;
private Locale mLocale;
@@ -224,7 +225,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
mMenu.findItem(R.id.action_delete_view_post_detail_activity).setVisible(true);
}
mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mRetrofit,
- mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mPost,
+ mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost,
mPost.getSubredditNamePrefixed(), mLocale, mLoadSubredditIconAsyncTask,
new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
@@ -290,7 +291,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
}
mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mRetrofit,
- mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mPost,
+ mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost,
mPost.getSubredditNamePrefixed(), mLocale, mLoadSubredditIconAsyncTask,
new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
@@ -481,6 +482,27 @@ public class ViewPostDetailActivity extends AppCompatActivity {
}
}
+ void deleteComment(String fullName, int position) {
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.delete_this_comment)
+ .setMessage(R.string.are_you_sure)
+ .setPositiveButton(R.string.delete, (dialogInterface, i)
+ -> DeleteThing.delete(mOauthRetrofit, fullName, mAccessToken, new DeleteThing.DeleteThingListener() {
+ @Override
+ public void deleteSuccess() {
+ Toast.makeText(ViewPostDetailActivity.this, R.string.delete_post_success, Toast.LENGTH_SHORT).show();
+ mAdapter.deleteComment(position);
+ }
+
+ @Override
+ public void deleteFailed() {
+ Toast.makeText(ViewPostDetailActivity.this, R.string.delete_post_failed, Toast.LENGTH_SHORT).show();
+ }
+ }))
+ .setNegativeButton(R.string.cancel, null)
+ .show();
+ }
+
@Subscribe
public void onPostUpdateEvent(PostUpdateEventToDetailActivity event) {
if(mPost.getId().equals(event.postId)) {
@@ -578,6 +600,11 @@ public class ViewPostDetailActivity extends AppCompatActivity {
if(resultCode == RESULT_OK) {
refresh(true);
}
+ } else if(requestCode == EDIT_COMMENT_REQUEST_CODE) {
+ if(resultCode == RESULT_OK) {
+ mAdapter.editComment(data.getExtras().getString(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT),
+ data.getExtras().getInt(EditCommentActivity.EXTRA_EDITED_COMMENT_POSITION));
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
index 670547d9..ad007ae1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
@@ -31,6 +31,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.chip.Chip;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
@@ -385,6 +386,26 @@ public class ViewUserDetailActivity extends AppCompatActivity {
}
}
+ void deleteComment(String fullName) {
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.delete_this_comment)
+ .setMessage(R.string.are_you_sure)
+ .setPositiveButton(R.string.delete, (dialogInterface, i)
+ -> DeleteThing.delete(mOauthRetrofit, fullName, mAccessToken, new DeleteThing.DeleteThingListener() {
+ @Override
+ public void deleteSuccess() {
+ Toast.makeText(ViewUserDetailActivity.this, R.string.delete_post_success, Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void deleteFailed() {
+ Toast.makeText(ViewUserDetailActivity.this, R.string.delete_post_failed, Toast.LENGTH_SHORT).show();
+ }
+ }))
+ .setNegativeButton(R.string.cancel, null)
+ .show();
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.view_user_detail_activity, menu);
@@ -519,6 +540,7 @@ public class ViewUserDetailActivity extends AppCompatActivity {
Bundle bundle = new Bundle();
bundle.putString(CommentsListingFragment.EXTRA_USERNAME_KEY, username);
bundle.putString(CommentsListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(CommentsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
fragment.setArguments(bundle);
return fragment;
}
@@ -560,5 +582,11 @@ public class ViewUserDetailActivity extends AppCompatActivity {
commentsListingFragment.refresh();
}
}
+
+ public void refreshComments() {
+ if(commentsListingFragment != null) {
+ commentsListingFragment.refresh();
+ }
+ }
}
}
diff --git a/app/src/main/res/drawable/ic_outline_more_vert_24px.xml b/app/src/main/res/drawable/ic_outline_more_vert_24px.xml
new file mode 100644
index 00000000..568cbb4d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_outline_more_vert_24px.xml
@@ -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="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_edit_comment.xml b/app/src/main/res/layout/activity_edit_comment.xml
new file mode 100644
index 00000000..93504c14
--- /dev/null
+++ b/app/src/main/res/layout/activity_edit_comment.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/coordinator_layout_edit_comment_activity"
+ tools:context=".EditCommentActivity">
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/AppTheme.AppBarOverlay">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar_edit_comment_activity"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:popupTheme="@style/AppTheme.PopupOverlay"
+ app:navigationIcon="?attr/homeAsUpIndicator" />
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <EditText
+ android:id="@+id/post_text_content_edit_text_edit_comment_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="top"
+ android:padding="16dp"
+ android:hint="@string/post_text_content_hint"
+ android:inputType="textCapSentences|textMultiLine"
+ android:textSize="18sp"
+ android:background="#00000000"
+ android:textColor="@color/primaryTextColor"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_modify_comment_bottom_sheet.xml b/app/src/main/res/layout/fragment_modify_comment_bottom_sheet.xml
new file mode 100644
index 00000000..a419912e
--- /dev/null
+++ b/app/src/main/res/layout/fragment_modify_comment_bottom_sheet.xml
@@ -0,0 +1,38 @@
+<?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=".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: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:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
index 81f20963..9cdce5a0 100644
--- a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
+++ b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
@@ -96,7 +96,6 @@
android:id="@+id/video_type_linear_layout_post_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml
index 82281e14..1283aa5b 100644
--- a/app/src/main/res/layout/item_comment.xml
+++ b/app/src/main/res/layout/item_comment.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linear_layout_item_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -7,7 +9,7 @@
<View
android:id="@+id/vertical_block_item_post_comment"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDarkDayNightTheme"/>
@@ -50,7 +52,110 @@
android:layout_marginBottom="8dp"
android:textColor="@color/primaryTextColor"/>
- <RelativeLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/up_vote_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_arrow_upward_black_20dp"
+ android:tint="@android:color/tab_indicator_text"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_comment"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:gravity="center"
+ app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/down_vote_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_arrow_downward_black_20dp"
+ android:tint="@android:color/tab_indicator_text"
+ app:layout_constraintStart_toEndOf="@+id/score_text_view_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+
+ <ImageView
+ android:id="@+id/more_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_outline_more_vert_24px"
+ android:tint="@android:color/tab_indicator_text"
+ android:visibility="gone"
+ app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/expand_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_expand_less_black_20dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:visibility="gone"
+ app:layout_constraintEnd_toStartOf="@+id/share_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/share_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_outline_share_20px"
+ android:tint="@android:color/tab_indicator_text"
+ app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/reply_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_reply_black_20dp"
+ android:tint="@android:color/tab_indicator_text"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <!--<RelativeLayout
android:id="@+id/relative_layout_item_post_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -128,7 +233,7 @@
android:clickable="true"
android:focusable="true"/>
- </RelativeLayout>
+ </RelativeLayout>-->
</LinearLayout>
diff --git a/app/src/main/res/menu/edit_comment_activity.xml b/app/src/main/res/menu/edit_comment_activity.xml
new file mode 100644
index 00000000..e52e484b
--- /dev/null
+++ b/app/src/main/res/menu/edit_comment_activity.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item
+ android:id="@+id/action_send_edit_comment_activity"
+ android:orderInCategory="1"
+ android:title="@string/action_send"
+ android:icon="@drawable/ic_send_white_24dp"
+ app:showAsAction="ifRoom" />
+</menu> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 392ffc9b..9b3dd695 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -182,7 +182,9 @@
<string name="login_first">Login first</string>
<string name="delete_this_post">Delete This Post</string>
+ <string name="delete_this_comment">Delete This Comment</string>
<string name="are_you_sure">Are you sure?</string>
+ <string name="edit">Edit</string>
<string name="delete">Delete</string>
<string name="cancel">Cancel</string>
<string name="delete_post_success">Delete successfully</string>