From 893c8a20769684e2d4493945aa69059e10a5f7e2 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 5 May 2020 14:30:46 +0800 Subject: [PATCH] Reporting comments is now available. --- .../Activity/ReportActivity.java | 1 + .../CommentMoreBottomSheetFragment.java | 12 ++++++++++++ .../main/res/drawable/ic_report_black_24dp.xml | 15 +++++++++++++++ .../fragment_comment_more_bottom_sheet.xml | 18 ++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 5 files changed, 48 insertions(+) create mode 100644 app/src/main/res/drawable/ic_report_black_24dp.xml diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java index 3092b8c7..4e3a0738 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java @@ -161,6 +161,7 @@ public class ReportActivity extends BaseActivity { case R.id.action_send_report_activity: ReportReason reportReason = mAdapter.getSelectedReason(); if (reportReason != null) { + Toast.makeText(ReportActivity.this, R.string.reporting, Toast.LENGTH_SHORT).show(); ReportThing.reportThing(mOauthRetrofit, mAccessToken, mFullname, mSubredditName, reportReason.getReasonType(), reportReason.getReportReason(), new ReportThing.ReportThingListener() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentMoreBottomSheetFragment.java index d339b5f6..fd97f1d4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentMoreBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentMoreBottomSheetFragment.java @@ -22,6 +22,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity; +import ml.docilealligator.infinityforreddit.Activity.ReportActivity; import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.CommentData; @@ -44,6 +45,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag TextView shareTextView; @BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment) TextView copyTextView; + @BindView(R.id.report_view_comment_more_bottom_sheet_fragment) + TextView reportTextView; private AppCompatActivity activity; public CommentMoreBottomSheetFragment() { // Required empty public constructor @@ -119,6 +122,15 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag()); }); + reportTextView.setOnClickListener(view -> { + Intent intent = new Intent(activity, ReportActivity.class); + intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, commentData.getSubredditName()); + intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, commentData.getFullName()); + activity.startActivity(intent); + + dismiss(); + }); + return rootView; } diff --git a/app/src/main/res/drawable/ic_report_black_24dp.xml b/app/src/main/res/drawable/ic_report_black_24dp.xml new file mode 100644 index 00000000..6e07b06d --- /dev/null +++ b/app/src/main/res/drawable/ic_report_black_24dp.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml index d60fe273..ddd3e572 100644 --- a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml @@ -81,6 +81,24 @@ android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" /> + + \ 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 e39cd2cf..c12d7105 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -705,6 +705,8 @@ %1$d Awards 1 Award + Report + Reporting Reported Report failed You haven\'t selected a reason