|
|
@ -248,7 +248,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
private State state = State.NONE;
|
|
|
|
private State state = State.NONE;
|
|
|
|
private boolean show_images = false;
|
|
|
|
private boolean show_images = false;
|
|
|
|
private boolean autosave = false;
|
|
|
|
private boolean autosave = false;
|
|
|
|
private boolean busy = false;
|
|
|
|
private boolean busy = true;
|
|
|
|
private boolean saved = false;
|
|
|
|
private boolean saved = false;
|
|
|
|
private int last_available = 0; // attachments
|
|
|
|
private int last_available = 0; // attachments
|
|
|
|
|
|
|
|
|
|
|
@ -555,7 +555,8 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
Object tag = cbSignature.getTag();
|
|
|
|
Object tag = cbSignature.getTag();
|
|
|
|
if (tag == null || !tag.equals(checked)) {
|
|
|
|
if (tag == null || !tag.equals(checked)) {
|
|
|
|
cbSignature.setTag(checked);
|
|
|
|
cbSignature.setTag(checked);
|
|
|
|
onAction(R.id.action_save);
|
|
|
|
if (tag != null)
|
|
|
|
|
|
|
|
onAction(R.id.action_save, "signature");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -640,7 +641,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
onActionCheck();
|
|
|
|
onActionCheck();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
onAction(action);
|
|
|
|
onAction(action, "navigation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -960,7 +961,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putString("html", html);
|
|
|
|
extras.putString("html", html);
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
onAction(R.id.action_save, extras);
|
|
|
|
onAction(R.id.action_save, extras, "refedit");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -974,7 +975,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putString("html", HtmlHelper.toHtml(etBody.getText()));
|
|
|
|
extras.putString("html", HtmlHelper.toHtml(etBody.getText()));
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
onAction(R.id.action_save, extras);
|
|
|
|
onAction(R.id.action_save, extras, "refdelete");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -985,7 +986,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
show_images = true;
|
|
|
|
show_images = true;
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
extras.putBoolean("show", true);
|
|
|
|
onAction(R.id.action_save, extras);
|
|
|
|
onAction(R.id.action_save, extras, "refimages");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -1076,7 +1077,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onPause() {
|
|
|
|
public void onPause() {
|
|
|
|
if (autosave && state == State.LOADED && !busy)
|
|
|
|
if (autosave && state == State.LOADED && !busy)
|
|
|
|
onAction(R.id.action_save);
|
|
|
|
onAction(R.id.action_save, "pause");
|
|
|
|
|
|
|
|
|
|
|
|
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
cm.unregisterNetworkCallback(networkCallback);
|
|
|
|
cm.unregisterNetworkCallback(networkCallback);
|
|
|
@ -1509,7 +1510,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
private void onActionDiscard() {
|
|
|
|
private void onActionDiscard() {
|
|
|
|
if (isEmpty())
|
|
|
|
if (isEmpty())
|
|
|
|
onAction(R.id.action_delete);
|
|
|
|
onAction(R.id.action_delete, "discard");
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putString("question", getString(R.string.title_ask_discard));
|
|
|
|
args.putString("question", getString(R.string.title_ask_discard));
|
|
|
@ -1527,7 +1528,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putBoolean("dialog", send_dialog);
|
|
|
|
extras.putBoolean("dialog", send_dialog);
|
|
|
|
onAction(R.id.action_check, extras);
|
|
|
|
onAction(R.id.action_check, extras, "check");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onEncrypt(final EntityMessage draft, final int action, final boolean interactive) {
|
|
|
|
private void onEncrypt(final EntityMessage draft, final int action, final boolean interactive) {
|
|
|
@ -1720,11 +1721,11 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case REQUEST_SEND:
|
|
|
|
case REQUEST_SEND:
|
|
|
|
if (resultCode == RESULT_OK)
|
|
|
|
if (resultCode == RESULT_OK)
|
|
|
|
onAction(R.id.action_send);
|
|
|
|
onAction(R.id.action_send, "send");
|
|
|
|
else if (resultCode == RESULT_FIRST_USER) {
|
|
|
|
else if (resultCode == RESULT_FIRST_USER) {
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putBoolean("now", true);
|
|
|
|
extras.putBoolean("now", true);
|
|
|
|
onAction(R.id.action_send, extras);
|
|
|
|
onAction(R.id.action_send, extras, "sendnow");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1934,7 +1935,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Save text & update remote draft
|
|
|
|
// Save text & update remote draft
|
|
|
|
onAction(R.id.action_save);
|
|
|
|
onAction(R.id.action_save, "addattachment");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -2237,7 +2238,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
int action = args.getInt("action");
|
|
|
|
int action = args.getInt("action");
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putBoolean("encrypted", true);
|
|
|
|
extras.putBoolean("encrypted", true);
|
|
|
|
onAction(action, extras);
|
|
|
|
onAction(action, extras, "pgp");
|
|
|
|
} else if (result instanceof Intent) {
|
|
|
|
} else if (result instanceof Intent) {
|
|
|
|
Intent intent = (Intent) result;
|
|
|
|
Intent intent = (Intent) result;
|
|
|
|
onPgp(intent);
|
|
|
|
onPgp(intent);
|
|
|
@ -2496,7 +2497,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
protected void onExecuted(Bundle args, Void result) {
|
|
|
|
protected void onExecuted(Bundle args, Void result) {
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
extras.putBoolean("encrypted", true);
|
|
|
|
extras.putBoolean("encrypted", true);
|
|
|
|
onAction(action, extras);
|
|
|
|
onAction(action, extras, "smime");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -2646,17 +2647,17 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onActionDiscardConfirmed() {
|
|
|
|
private void onActionDiscardConfirmed() {
|
|
|
|
onAction(R.id.action_delete);
|
|
|
|
onAction(R.id.action_delete, "delete");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onExit() {
|
|
|
|
private void onExit() {
|
|
|
|
if (state != State.LOADED)
|
|
|
|
if (state != State.LOADED)
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
else if (isEmpty() && !saved)
|
|
|
|
else if (isEmpty() && !saved)
|
|
|
|
onAction(R.id.action_delete);
|
|
|
|
onAction(R.id.action_delete, "empty");
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
autosave = false;
|
|
|
|
autosave = false;
|
|
|
|
onAction(R.id.action_save);
|
|
|
|
onAction(R.id.action_save, "exit");
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2669,11 +2670,11 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onAction(int action) {
|
|
|
|
private void onAction(int action, String reason) {
|
|
|
|
onAction(action, new Bundle());
|
|
|
|
onAction(action, new Bundle(), reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onAction(int action, @NonNull Bundle extras) {
|
|
|
|
private void onAction(int action, @NonNull Bundle extras, String reason) {
|
|
|
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
|
|
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
|
|
|
|
|
|
|
|
|
|
|
// Workaround underlines left by Android
|
|
|
|
// Workaround underlines left by Android
|
|
|
@ -2695,7 +2696,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
args.putBoolean("interactive", getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED));
|
|
|
|
args.putBoolean("interactive", getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED));
|
|
|
|
args.putBundle("extras", extras);
|
|
|
|
args.putBundle("extras", extras);
|
|
|
|
|
|
|
|
|
|
|
|
Log.i("Run execute id=" + working);
|
|
|
|
Log.i("Run execute id=" + working + " reason=" + reason);
|
|
|
|
actionLoader.execute(this, args, "compose:action:" + action);
|
|
|
|
actionLoader.execute(this, args, "compose:action:" + action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3547,6 +3548,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
final String action = getArguments().getString("action");
|
|
|
|
final String action = getArguments().getString("action");
|
|
|
|
Log.i("Loaded draft id=" + data.draft.id + " action=" + action + " saved=" + saved);
|
|
|
|
Log.i("Loaded draft id=" + data.draft.id + " action=" + action + " saved=" + saved);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
busy = false;
|
|
|
|
working = data.draft.id;
|
|
|
|
working = data.draft.id;
|
|
|
|
encrypt = data.draft.ui_encrypt;
|
|
|
|
encrypt = data.draft.ui_encrypt;
|
|
|
|
getActivity().invalidateOptionsMenu();
|
|
|
|
getActivity().invalidateOptionsMenu();
|
|
|
@ -3619,7 +3621,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
// Attachment deleted: update remote draft
|
|
|
|
// Attachment deleted: update remote draft
|
|
|
|
if (available < last_available)
|
|
|
|
if (available < last_available)
|
|
|
|
onAction(R.id.action_save);
|
|
|
|
onAction(R.id.action_save, "delattachment");
|
|
|
|
|
|
|
|
|
|
|
|
last_available = available;
|
|
|
|
last_available = available;
|
|
|
|
|
|
|
|
|
|
|
@ -4221,7 +4223,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
fragment.setTargetFragment(FragmentCompose.this, REQUEST_SEND);
|
|
|
|
fragment.setTargetFragment(FragmentCompose.this, REQUEST_SEND);
|
|
|
|
fragment.show(getParentFragmentManager(), "compose:send");
|
|
|
|
fragment.show(getParentFragmentManager(), "compose:send");
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
onAction(R.id.action_send);
|
|
|
|
onAction(R.id.action_send, "dialog");
|
|
|
|
|
|
|
|
|
|
|
|
} else if (action == R.id.action_send) {
|
|
|
|
} else if (action == R.id.action_send) {
|
|
|
|
autosave = false;
|
|
|
|
autosave = false;
|
|
|
@ -4503,7 +4505,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onKeyPressed(KeyEvent event) {
|
|
|
|
public boolean onKeyPressed(KeyEvent event) {
|
|
|
|
if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.isCtrlPressed()) {
|
|
|
|
if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.isCtrlPressed()) {
|
|
|
|
onAction(R.id.action_send);
|
|
|
|
onAction(R.id.action_send, "enter");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|