Directly edit comment in FullMarkdownActivity for EditCommentActivity.

This commit is contained in:
Alex Ning 2021-07-22 19:43:29 +08:00
parent 346cb491f3
commit 25b812fe4a

View File

@ -69,6 +69,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
private static final int PICK_IMAGE_REQUEST_CODE = 100;
private static final int CAPTURE_IMAGE_REQUEST_CODE = 200;
private static final int MARKDOWN_PREVIEW_REQUEST_CODE = 300;
private static final String UPLOADED_IMAGES_STATE = "UIS";
@ -207,8 +208,18 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
Intent intent = new Intent(this, FullMarkdownActivity.class);
intent.putExtra(FullMarkdownActivity.EXTRA_COMMENT_MARKDOWN, contentEditText.getText().toString());
intent.putExtra(FullMarkdownActivity.EXTRA_SUBMIT_POST, true);
startActivity(intent);
startActivityForResult(intent, MARKDOWN_PREVIEW_REQUEST_CODE);
} else if (item.getItemId() == R.id.action_send_edit_comment_activity) {
editComment();
return true;
} else if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return false;
}
private void editComment() {
if (!isSubmitting) {
isSubmitting = true;
@ -248,12 +259,6 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
});
}
return true;
} else if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return false;
}
private void promptAlertDialog(int titleResId, int messageResId) {
@ -280,6 +285,8 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
editComment();
}
}
}