Added option for group email addresses

pull/183/head
M66B 4 years ago
parent a245ed28da
commit e2438261c5

File diff suppressed because it is too large Load Diff

@ -71,6 +71,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
private ImageView ivSync;
private ImageView ivOAuth;
private ImageView ivPrimary;
private ImageView ivGroup;
private TextView tvName;
private TextView tvUser;
private TextView tvHost;
@ -90,6 +91,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
ivSync = itemView.findViewById(R.id.ivSync);
ivOAuth = itemView.findViewById(R.id.ivOAuth);
ivPrimary = itemView.findViewById(R.id.ivPrimary);
ivGroup = itemView.findViewById(R.id.ivGroup);
tvName = itemView.findViewById(R.id.tvName);
tvUser = itemView.findViewById(R.id.tvUser);
tvHost = itemView.findViewById(R.id.tvHost);
@ -119,6 +121,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
ivOAuth.setVisibility(identity.auth_type == EmailService.AUTH_TYPE_PASSWORD ? View.GONE : View.VISIBLE);
ivPrimary.setVisibility(identity.primary ? View.VISIBLE : View.GONE);
ivGroup.setVisibility(identity.self ? View.GONE : View.VISIBLE);
tvName.setText(identity.getDisplayName());
tvUser.setText(identity.email);

@ -61,7 +61,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 167,
version = 168,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1649,6 +1649,13 @@ public abstract class DB extends RoomDatabase {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `labels` TEXT");
}
})
.addMigrations(new Migration(167, 168) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `identity` ADD COLUMN `self` INTEGER NOT NULL DEFAULT 1");
}
});
}

@ -90,6 +90,8 @@ public class EntityIdentity {
@NonNull
public Boolean primary;
@NonNull
public Boolean self = true;
@NonNull
public Boolean sender_extra = false;
public String sender_extra_regex;
public String replyto;
@ -189,6 +191,7 @@ public class EntityIdentity {
json.put("synchronize", synchronize);
json.put("primary", primary);
json.put("self", self);
json.put("sender_extra", sender_extra);
json.put("sender_extra_regex", sender_extra_regex);
@ -242,6 +245,8 @@ public class EntityIdentity {
identity.synchronize = json.getBoolean("synchronize");
identity.primary = json.getBoolean("primary");
identity.self = json.optBoolean("self", true);
if (json.has("sender_extra"))
identity.sender_extra = json.getBoolean("sender_extra");
if (json.has("sender_extra_regex"))
@ -279,6 +284,7 @@ public class EntityIdentity {
Objects.equals(this.ehlo, other.ehlo) &&
this.synchronize.equals(other.synchronize) &&
this.primary.equals(other.primary) &&
this.self.equals(other.self) &&
this.sender_extra.equals(other.sender_extra) &&
Objects.equals(this.sender_extra_regex, other.sender_extra_regex) &&
Objects.equals(this.replyto, other.replyto) &&

@ -223,7 +223,9 @@ public class EntityMessage implements Serializable {
if (identities != null)
for (Address address : new ArrayList<>(addresses))
for (TupleIdentityEx identity : identities)
if (identity.account == account && identity.similarAddress(address))
if (identity.account == account &&
identity.self &&
identity.similarAddress(address))
addresses.remove(address);
return addresses.toArray(new Address[0]);

@ -105,6 +105,7 @@ public class FragmentIdentity extends FragmentBase {
private CheckBox cbSynchronize;
private CheckBox cbPrimary;
private CheckBox cbSelf;
private CheckBox cbSenderExtra;
private TextView etSenderExtra;
@ -196,6 +197,7 @@ public class FragmentIdentity extends FragmentBase {
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbPrimary = view.findViewById(R.id.cbPrimary);
cbSelf = view.findViewById(R.id.cbSelf);
cbSenderExtra = view.findViewById(R.id.cbSenderExtra);
etSenderExtra = view.findViewById(R.id.etSenderExtra);
@ -601,6 +603,7 @@ public class FragmentIdentity extends FragmentBase {
args.putString("signature", signature);
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putBoolean("self", cbSelf.isChecked());
args.putBoolean("should", should);
@ -651,6 +654,7 @@ public class FragmentIdentity extends FragmentBase {
String ehlo = args.getString("ehlo");
boolean synchronize = args.getBoolean("synchronize");
boolean primary = args.getBoolean("primary");
boolean self = args.getBoolean("self");
boolean sender_extra = args.getBoolean("sender_extra");
String sender_extra_regex = args.getString("sender_extra_regex");
@ -781,6 +785,8 @@ public class FragmentIdentity extends FragmentBase {
return true;
if (!Objects.equals(identity.primary, (identity.synchronize && primary)))
return true;
if (!Objects.equals(identity.self, self))
return true;
if (!Objects.equals(identity.sender_extra, sender_extra))
return true;
if (!Objects.equals(identity.sender_extra_regex, sender_extra_regex))
@ -869,6 +875,7 @@ public class FragmentIdentity extends FragmentBase {
identity.ehlo = ehlo;
identity.synchronize = synchronize;
identity.primary = (identity.synchronize && primary);
identity.self = self;
identity.sender_extra = sender_extra;
identity.sender_extra_regex = sender_extra_regex;
@ -1073,6 +1080,7 @@ public class FragmentIdentity extends FragmentBase {
etEhlo.setText(identity == null ? null : identity.ehlo);
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
cbPrimary.setChecked(identity == null ? true : identity.primary);
cbSelf.setChecked(identity == null ? true : identity.self);
cbSenderExtra.setChecked(identity != null && identity.sender_extra);
etSenderExtra.setText(identity == null ? null : identity.sender_extra_regex);

@ -539,6 +539,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<CheckBox
android:id="@+id/cbSelf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_self_identity"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
<CheckBox
android:id="@+id/cbSenderExtra"
android:layout_width="wrap_content"
@ -546,7 +556,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_sender"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
app:layout_constraintTop_toBottomOf="@id/cbSelf" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSenderExtra"
@ -794,7 +804,7 @@
tvUser,etUser,tvPassword,tilPassword,tvCaseSensitiveHint,btnCertificate,tvCertificate,btnOAuth,
tvRealm,etRealm,
cbUseIp,tvUseIpHint,tvEhlo,etEhlo,
cbSynchronize,cbPrimary,
cbSynchronize,cbPrimary,cbSelf,
cbSenderExtra,tvSenderExtra,etSenderExtra,tvSenderExtraHint,
tvReplyTo,etReplyTo,tvCc,etCc,tvCcHint,tvBcc,etBcc,tvBccHint,cbUnicode" />

@ -66,6 +66,17 @@
app:layout_constraintTop_toTopOf="@+id/tvName"
app:srcCompat="@drawable/baseline_star_24" />
<ImageView
android:id="@+id/ivGroup"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/title_legend_primary"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/ivPrimary"
app:layout_constraintTop_toTopOf="@+id/tvName"
app:srcCompat="@drawable/baseline_people_24" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvName"
android:layout_width="0dp"
@ -79,7 +90,7 @@
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toStartOf="@+id/ivSync"
app:layout_constraintStart_toEndOf="@id/ivPrimary"
app:layout_constraintStart_toEndOf="@id/ivGroup"
app:layout_constraintTop_toBottomOf="@id/marginTop" />
<ImageView

@ -600,6 +600,7 @@
<string name="title_primary">Primary</string>
<string name="title_primary_account">Primary (default account)</string>
<string name="title_primary_identity">Primary (default identity)</string>
<string name="title_self_identity">Remove email address when replying</string>
<string name="title_leave_on_server">Leave messages on server</string>
<string name="title_leave_deleted">Leave deleted messages on server</string>
<string name="title_leave_on_device">Leave messages on device</string>

Loading…
Cancel
Save