From 4dc119cf3de61b4af019177bcf61e0be830d31d7 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 3 Apr 2020 21:47:26 +0200 Subject: [PATCH] Small improvement --- .../java/eu/faircode/email/FragmentCompose.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 8a345c595c..7b9020d43a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1429,9 +1429,11 @@ public class FragmentCompose extends FragmentBase { snackbar.show(); } else try { + setBusy(true); startActivityForResult(intent, REQUEST_RECORD_AUDIO); } catch (SecurityException ex) { Log.w(ex); + setBusy(false); Snackbar.make(view, getString(R.string.title_no_viewer, intent.getAction()), Snackbar.LENGTH_INDEFINITE).show(); } } @@ -1458,8 +1460,10 @@ public class FragmentCompose extends FragmentBase { PackageManager pm = getContext().getPackageManager(); if (intent.resolveActivity(pm) == null) noStorageAccessFramework(); - else + else { + setBusy(true); startActivityForResult(Helper.getChooser(getContext(), intent), REQUEST_ATTACHMENT); + } } private void noStorageAccessFramework() { @@ -1684,10 +1688,12 @@ public class FragmentCompose extends FragmentBase { onAddImage(data.getBundleExtra("args").getBoolean("photo")); break; case REQUEST_IMAGE_FILE: + setBusy(false); if (resultCode == RESULT_OK && data != null) onAddImageFile(getUris(data)); break; case REQUEST_TAKE_PHOTO: + setBusy(false); if (resultCode == RESULT_OK) { if (photoURI != null) onAddImageFile(Arrays.asList(photoURI)); @@ -1695,6 +1701,7 @@ public class FragmentCompose extends FragmentBase { break; case REQUEST_ATTACHMENT: case REQUEST_RECORD_AUDIO: + setBusy(false); if (resultCode == RESULT_OK && data != null) onAddAttachment(getUris(data), false, 0); break; @@ -1850,8 +1857,10 @@ public class FragmentCompose extends FragmentBase { try { photoURI = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file); intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); + setBusy(true); startActivityForResult(intent, REQUEST_TAKE_PHOTO); } catch (SecurityException ex) { + setBusy(false); Log.w(ex); Snackbar.make(view, getString(R.string.title_no_viewer, intent.getAction()), Snackbar.LENGTH_LONG).show(); } @@ -1864,8 +1873,10 @@ public class FragmentCompose extends FragmentBase { PackageManager pm = getContext().getPackageManager(); if (intent.resolveActivity(pm) == null) noStorageAccessFramework(); - else + else { + setBusy(true); startActivityForResult(Helper.getChooser(getContext(), intent), REQUEST_IMAGE_FILE); + } } }