use of com.ferg.awfulapp.task.ReportRequest in project Awful.apk by Awful.
the class ThreadDisplayFragment method reportUser.
/**
* Display a dialog to report a post
*
* @param postId The ID of the bad post
*/
public void reportUser(int postId) {
final EditText reportReason = new EditText(this.getActivity());
new AlertDialog.Builder(this.getActivity()).setTitle("Report inappropriate post").setMessage("Did this post break the forum rules? If so, please report it by clicking below. If you would like to add any comments explaining why you submitted this post, please do so here:").setView(reportReason).setPositiveButton("Report", (dialog, whichButton) -> {
String reason = reportReason.getText().toString();
queueRequest(new ReportRequest(getActivity(), postId, reason).build(ThreadDisplayFragment.this, new AwfulRequest.AwfulResultCallback<String>() {
@Override
public void success(String result) {
getAlertView().setTitle(result).setIcon(R.drawable.ic_mood).show();
}
@Override
public void failure(VolleyError error) {
getAlertView().setTitle(error.getMessage()).setIcon(R.drawable.ic_mood).show();
}
}));
}).setNegativeButton(R.string.cancel, null).show();
}
Aggregations