Fixed auo save / encryption

This commit is contained in:
M66B 2020-04-02 19:04:56 +02:00
parent 94f8b61850
commit eb736b6a91
1 changed files with 10 additions and 7 deletions

View File

@ -1075,8 +1075,8 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
public void onPause() { public void onPause() {
//if (autosave && state == State.LOADED) if (autosave && state == State.LOADED && !busy)
// onAction(R.id.action_save); onAction(R.id.action_save);
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
cm.unregisterNetworkCallback(networkCallback); cm.unregisterNetworkCallback(networkCallback);
@ -1591,6 +1591,8 @@ public class FragmentCompose extends FragmentBase {
snackbar.show(); snackbar.show();
} }
}); });
else
setBusy(false);
} }
@Override @Override
@ -1637,6 +1639,7 @@ public class FragmentCompose extends FragmentBase {
onPgp(intent); onPgp(intent);
} catch (Throwable ex) { } catch (Throwable ex) {
setBusy(false);
if (ex instanceof IllegalArgumentException) if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show(); Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else { else {
@ -2252,6 +2255,7 @@ public class FragmentCompose extends FragmentBase {
Log.unexpectedError(getParentFragmentManager(), ex); Log.unexpectedError(getParentFragmentManager(), ex);
} }
else { else {
setBusy(false);
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
ToastEx.makeText(getContext(), "Non interactive", Toast.LENGTH_SHORT).show(); ToastEx.makeText(getContext(), "Non interactive", Toast.LENGTH_SHORT).show();
} }
@ -2259,6 +2263,7 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
setBusy(false);
if (ex instanceof OperationCanceledException) if (ex instanceof OperationCanceledException)
; // Do nothing ; // Do nothing
else if (ex instanceof IllegalArgumentException) { else if (ex instanceof IllegalArgumentException) {
@ -2496,6 +2501,7 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
setBusy(false);
if (ex instanceof IllegalArgumentException) { if (ex instanceof IllegalArgumentException) {
Log.i(ex); Log.i(ex);
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG); Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG);
@ -3693,7 +3699,8 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onPostExecute(Bundle args) { protected void onPostExecute(Bundle args) {
int action = args.getInt("action"); int action = args.getInt("action");
if (action != R.id.action_check) boolean needsEncryption = args.getBoolean("needsEncryption");
if (action != R.id.action_check && !needsEncryption)
setBusy(false); setBusy(false);
} }
@ -4224,10 +4231,6 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
int action = args.getInt("action");
if (action == R.id.action_check)
setBusy(false);
if (ex instanceof MessageRemovedException) if (ex instanceof MessageRemovedException)
finish(); finish();
else if (ex instanceof AddressException) { else if (ex instanceof AddressException) {