Reporting comments is now available.

This commit is contained in:
Alex Ning 2020-05-05 14:30:46 +08:00
parent d444a3a084
commit 893c8a2076
5 changed files with 48 additions and 0 deletions

View File

@ -161,6 +161,7 @@ public class ReportActivity extends BaseActivity {
case R.id.action_send_report_activity: case R.id.action_send_report_activity:
ReportReason reportReason = mAdapter.getSelectedReason(); ReportReason reportReason = mAdapter.getSelectedReason();
if (reportReason != null) { if (reportReason != null) {
Toast.makeText(ReportActivity.this, R.string.reporting, Toast.LENGTH_SHORT).show();
ReportThing.reportThing(mOauthRetrofit, mAccessToken, mFullname, mSubredditName, ReportThing.reportThing(mOauthRetrofit, mAccessToken, mFullname, mSubredditName,
reportReason.getReasonType(), reportReason.getReportReason(), new ReportThing.ReportThingListener() { reportReason.getReasonType(), reportReason.getReportReason(), new ReportThing.ReportThingListener() {
@Override @Override

View File

@ -22,6 +22,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity; import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.CommentData; import ml.docilealligator.infinityforreddit.CommentData;
@ -44,6 +45,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
TextView shareTextView; TextView shareTextView;
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment) @BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
TextView copyTextView; TextView copyTextView;
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
TextView reportTextView;
private AppCompatActivity activity; private AppCompatActivity activity;
public CommentMoreBottomSheetFragment() { public CommentMoreBottomSheetFragment() {
// Required empty public constructor // Required empty public constructor
@ -119,6 +122,15 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag()); 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; return rootView;
} }

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.73,3H8.27L3,8.27v7.46L8.27,21h7.46L21,15.73V8.27L15.73,3zM19,14.9L14.9,19H9.1L5,14.9V9.1L9.1,5h5.8L19,9.1v5.8z"
android:fillColor="#000000"/>
<path
android:pathData="M12,16m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"
android:fillColor="#000000"/>
<path
android:pathData="M11,7h2v7h-2z"
android:fillColor="#000000"/>
</vector>

View File

@ -81,6 +81,24 @@
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default" /> android:textSize="?attr/font_default" />
<TextView
android:id="@+id/report_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_report_black_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/report"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@ -705,6 +705,8 @@
<string name="n_awards">%1$d Awards</string> <string name="n_awards">%1$d Awards</string>
<string name="one_award">1 Award</string> <string name="one_award">1 Award</string>
<string name="report">Report</string>
<string name="reporting">Reporting</string>
<string name="report_successful">Reported</string> <string name="report_successful">Reported</string>
<string name="report_failed">Report failed</string> <string name="report_failed">Report failed</string>
<string name="report_reason_not_selected">You haven\'t selected a reason</string> <string name="report_reason_not_selected">You haven\'t selected a reason</string>