From 63e40513fbba1da8e7f59c0ba1a78dbd3d402919 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 3 Aug 2018 15:12:35 +0000 Subject: [PATCH] Several fixes --- app/src/main/java/eu/faircode/email/FragmentIdentity.java | 8 ++++++-- app/src/main/java/eu/faircode/email/FragmentMessages.java | 8 ++++---- .../main/java/eu/faircode/email/ServiceSynchronize.java | 5 +++++ app/src/main/res/values/strings.xml | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 134fb1e7..a5ed0d71 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -160,7 +160,7 @@ public class FragmentIdentity extends Fragment { args.putBoolean("starttls", cbStartTls.isChecked()); args.putString("port", etPort.getText().toString()); args.putString("user", etUser.getText().toString()); - args.putString("password", tilPassword.getEditText().toString()); + args.putString("password", tilPassword.getEditText().getText().toString()); args.putBoolean("primary", cbPrimary.isChecked()); args.putBoolean("synchronize", cbSynchronize.isChecked()); @@ -208,9 +208,13 @@ public class FragmentIdentity extends Fragment { public Throwable loadInBackground() { try { long id = args.getLong("id"); + String replyto = args.getString("replyto"); String host = args.getString("host"); boolean starttls = args.getBoolean("starttls"); String port = args.getString("port"); + + if (TextUtils.isEmpty(replyto)) + replyto = null; if (TextUtils.isEmpty(port)) port = "0"; @@ -221,7 +225,7 @@ public class FragmentIdentity extends Fragment { identity = new EntityIdentity(); identity.name = Objects.requireNonNull(args.getString("name")); identity.email = Objects.requireNonNull(args.getString("email")); - identity.replyto = args.getString("replyto"); + identity.replyto = replyto; identity.host = host; identity.port = Integer.parseInt(port); identity.starttls = starttls; diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index f88e19a2..8025d5de 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -92,7 +92,7 @@ public class FragmentMessages extends Fragment { tvNoEmail.setVisibility(View.GONE); grpReady.setVisibility(View.GONE); pbWait.setVisibility(View.VISIBLE); - fab.setEnabled(false); + fab.setVisibility(View.GONE); DB db = DB.getInstance(getContext()); @@ -109,8 +109,6 @@ public class FragmentMessages extends Fragment { db.message().liveThread(thread).observe(this, messagesObserver); } - getLoaderManager().restartLoader(ActivityView.LOADER_MESSAGES_INIT, new Bundle(), initLoaderCallbacks).forceLoad(); - return view; } @@ -121,6 +119,8 @@ public class FragmentMessages extends Fragment { ((AppCompatActivity) getActivity()).getSupportActionBar().setSubtitle(R.string.title_folder_thread); else liveFolder.observe(this, folderObserver); + + getLoaderManager().restartLoader(ActivityView.LOADER_MESSAGES_INIT, new Bundle(), initLoaderCallbacks).forceLoad(); } @Override @@ -181,7 +181,7 @@ public class FragmentMessages extends Fragment { @Override public void onLoadFinished(@NonNull Loader loader, Bundle data) { - fab.setEnabled(data.getBoolean("drafts", false)); + fab.setVisibility(data.getBoolean("drafts", false) ? View.VISIBLE : View.GONE); } @Override diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 21b5ec00..904e47c9 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -639,6 +639,11 @@ public class ServiceSynchronize extends LifecycleService { EntityMessage reply = (msg.replying == null ? null : message.getMessage(msg.replying)); EntityIdentity ident = db.identity().getIdentity(msg.identity); + if (!ident.synchronize) { + // Message will remain in outbox + return; + } + Properties props = MessageHelper.getSessionProperties(); Session isession = Session.getDefaultInstance(props, null); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e2b71029..449ba8b7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,7 +54,7 @@ Password Synchronize (receive messages) Synchronize (send messages) - Primary (use to store drafts) + Primary (used to store drafts) Primary (default identity) Name mandatory Email address mandatory