Fixed reply to self, layout improvements

This commit is contained in:
M66B 2018-09-05 16:18:46 +00:00
parent cf0e6386ba
commit 108bd1159a
4 changed files with 13 additions and 14 deletions

View File

@ -683,22 +683,21 @@ public class FragmentCompose extends FragmentEx {
account = ref.account; account = ref.account;
// Reply to recipient, not to known self // Reply to recipient, not to known self
String from = (ref.from == null || ref.from.length == 0 ? null : ((InternetAddress) ref.from[0]).getAddress()); if (ref.from != null && ref.from.length > 0) {
String replyto = (ref.reply == null || ref.reply.length == 0 ? null : ((InternetAddress) ref.reply[0]).getAddress()); String from = Helper.canonicalAddress(((InternetAddress) ref.from[0]).getAddress());
List<EntityIdentity> identities = db.identity().getIdentities(); List<EntityIdentity> identities = db.identity().getIdentities();
for (EntityIdentity identity : identities) for (EntityIdentity identity : identities) {
if (replyto == null) { String email = Helper.canonicalAddress(identity.email);
if (from != null && from.equals(identity.email)) { if (from.equals(email)) {
Log.i(Helper.TAG, "Swapping from/to");
Address[] tmp = ref.to; Address[] tmp = ref.to;
ref.to = ref.from; ref.to = ref.from;
ref.reply = null; ref.reply = null;
ref.from = tmp; ref.from = tmp;
break; break;
} }
} else if (replyto.equals(identity.email)) {
ref.reply = ref.to;
break;
} }
}
} }
EntityFolder drafts; EntityFolder drafts;
@ -881,9 +880,9 @@ public class FragmentCompose extends FragmentEx {
// Select identity matching from address // Select identity matching from address
if (!found && draft.from != null && draft.from.length > 0) { if (!found && draft.from != null && draft.from.length > 0) {
String from = Helper.canonicalAddress(((InternetAddress) draft.from[0]).getAddress()); String from = Helper.canonicalAddress(((InternetAddress) draft.from[0]).getAddress());
for (int pos = 0; pos < identities.size(); pos++) { for (int pos = 0; pos < identities.size(); pos++) {
if (Helper.canonicalAddress(identities.get(pos).email).equals(from)) { String email = Helper.canonicalAddress(identities.get(pos).email);
if (email.equals(from)) {
spFrom.setSelection(pos); spFrom.setSelection(pos);
found = true; found = true;
break; break;

View File

@ -84,7 +84,7 @@
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:text="error" android:text="error"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold" android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHost" /> app:layout_constraintTop_toBottomOf="@id/tvHost" />

View File

@ -109,7 +109,7 @@
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:text="error" android:text="error"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold" android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivState" /> app:layout_constraintTop_toBottomOf="@id/ivState" />

View File

@ -96,7 +96,7 @@
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:text="error" android:text="error"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold" android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHost" /> app:layout_constraintTop_toBottomOf="@id/tvHost" />