aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-16 15:09:12 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-16 15:09:12 +0000
commit840383b30ff7e8a0573af696bcf5b1ac5052d4b7 (patch)
treebe207fbdc8d672ab1b3ed49cc629872c54ab328d /app/src/main/java/ml/docilealligator
parente877b2e4391bf9f67a113541ef1addc5f7b7a5aa (diff)
downloadinfinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar.gz
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar.bz2
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar.lz
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar.xz
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.tar.zst
infinity-for-reddit-840383b30ff7e8a0573af696bcf5b1ac5052d4b7.zip
Redirect user to ViewPostDetailActivity after submitting a gallery post.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
index 1e0e7084..91ec10df 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
@@ -68,6 +68,7 @@ import ml.docilealligator.infinityforreddit.asynctasks.LoadSubredditIcon;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.FlairBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SelectOrCaptureImageBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.events.SubmitGalleryPostEvent;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.services.SubmitPostService;
import ml.docilealligator.infinityforreddit.utils.JSONUtils;
@@ -684,4 +685,25 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
public void onAccountSwitchEvent(SwitchAccountEvent event) {
finish();
}
+
+ @Subscribe
+ public void onSubmitGalleryPostEvent(SubmitGalleryPostEvent submitGalleryPostEvent) {
+ isPosting = false;
+ mPostingSnackbar.dismiss();
+ if (submitGalleryPostEvent.postSuccess) {
+ Intent intent = new Intent(this, LinkResolverActivity.class);
+ intent.setData(Uri.parse(submitGalleryPostEvent.postUrl));
+ startActivity(intent);
+ finish();
+ } else {
+ mMemu.findItem(R.id.action_send_post_gallery_activity).setEnabled(true);
+ mMemu.findItem(R.id.action_send_post_gallery_activity).getIcon().setAlpha(255);
+ if (submitGalleryPostEvent.errorMessage == null || submitGalleryPostEvent.errorMessage.equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
+ } else {
+ Snackbar.make(coordinatorLayout, submitGalleryPostEvent.errorMessage.substring(0, 1).toUpperCase()
+ + submitGalleryPostEvent.errorMessage.substring(1), Snackbar.LENGTH_SHORT).show();
+ }
+ }
+ }
} \ No newline at end of file