Added sent by address

pull/172/head
M66B 5 years ago
parent f505d4ceeb
commit 57dca80bfb

File diff suppressed because it is too large Load Diff

@ -336,6 +336,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibNotifyContact;
private ImageButton ibAddContact;
private TextView tvSubmitterTitle;
private TextView tvFromExTitle;
private TextView tvToTitle;
private TextView tvReplyToTitle;
@ -346,6 +347,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvReceivedTitle;
private TextView tvSizeExTitle;
private TextView tvSubmitter;
private TextView tvFromEx;
private TextView tvTo;
private TextView tvReplyTo;
@ -496,6 +498,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibNotifyContact = vsBody.findViewById(R.id.ibNotifyContact);
ibAddContact = vsBody.findViewById(R.id.ibAddContact);
tvSubmitterTitle = vsBody.findViewById(R.id.tvSubmitterTitle);
tvFromExTitle = vsBody.findViewById(R.id.tvFromExTitle);
tvToTitle = vsBody.findViewById(R.id.tvToTitle);
tvReplyToTitle = vsBody.findViewById(R.id.tvReplyToTitle);
@ -506,6 +509,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvReceivedTitle = vsBody.findViewById(R.id.tvReceivedTitle);
tvSizeExTitle = vsBody.findViewById(R.id.tvSizeExTitle);
tvSubmitter = vsBody.findViewById(R.id.tvSubmitter);
tvFromEx = vsBody.findViewById(R.id.tvFromEx);
tvTo = vsBody.findViewById(R.id.tvTo);
tvReplyTo = vsBody.findViewById(R.id.tvReplyTo);
@ -1095,6 +1099,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibNotifyContact.setVisibility(View.GONE);
ibAddContact.setVisibility(View.GONE);
tvSubmitterTitle.setVisibility(View.GONE);
tvFromExTitle.setVisibility(View.GONE);
tvToTitle.setVisibility(View.GONE);
tvReplyToTitle.setVisibility(View.GONE);
@ -1105,6 +1110,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvReceivedTitle.setVisibility(View.GONE);
tvSizeExTitle.setVisibility(View.GONE);
tvSubmitter.setVisibility(View.GONE);
tvFromEx.setVisibility(View.GONE);
tvTo.setVisibility(View.GONE);
tvReplyTo.setVisibility(View.GONE);
@ -1268,12 +1274,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */);
ibExpanderAddress.setContentDescription(context.getString(show_addresses ? R.string.title_accessibility_hide_addresses : R.string.title_accessibility_show_addresses));
String submitter = MessageHelper.formatAddresses(message.submitter);
String from = MessageHelper.formatAddresses(message.senders);
String to = MessageHelper.formatAddresses(message.to);
String replyto = MessageHelper.formatAddresses(message.reply);
String cc = MessageHelper.formatAddresses(message.cc);
String bcc = MessageHelper.formatAddresses(message.bcc);
tvSubmitterTitle.setVisibility(show_addresses && !TextUtils.isEmpty(submitter) ? View.VISIBLE : View.GONE);
tvSubmitter.setVisibility(show_addresses && !TextUtils.isEmpty(submitter) ? View.VISIBLE : View.GONE);
tvSubmitter.setText(submitter);
tvFromExTitle.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
tvFromEx.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
tvFromEx.setText(from);

@ -1489,6 +1489,7 @@ class Core {
message.dkim = MessageHelper.getAuthentication("dkim", authentication);
message.spf = MessageHelper.getAuthentication("spf", authentication);
message.dmarc = MessageHelper.getAuthentication("dmarc", authentication);
message.submitter = helper.getSender();
message.from = helper.getFrom();
message.to = helper.getTo();
message.cc = helper.getCc();
@ -1517,6 +1518,9 @@ class Core {
message.ui_ignored = false;
message.ui_browsed = false;
if (MessageHelper.equal(message.submitter, message.from))
message.submitter = null;
if (message.size == null && message.total != null)
message.size = message.total;
@ -2090,6 +2094,7 @@ class Core {
message.dkim = MessageHelper.getAuthentication("dkim", authentication);
message.spf = MessageHelper.getAuthentication("spf", authentication);
message.dmarc = MessageHelper.getAuthentication("dmarc", authentication);
message.submitter = helper.getSender();
message.from = helper.getFrom();
message.to = helper.getTo();
message.cc = helper.getCc();
@ -2119,6 +2124,9 @@ class Core {
message.ui_ignored = seen;
message.ui_browsed = browsed;
if (MessageHelper.equal(message.submitter, message.from))
message.submitter = null;
// Borrow reply name from sender name
if (message.from != null && message.from.length == 1 &&
message.reply != null && message.reply.length == 1) {

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

@ -116,6 +116,7 @@ public class EntityMessage implements Serializable {
public Boolean mx = null;
public String avatar; // lookup URI from sender
public String sender; // sort key
public Address[] submitter;
public Address[] from;
public Address[] to;
public Address[] cc;

@ -873,6 +873,10 @@ public class MessageHelper {
return addresses;
}
Address[] getSender() throws MessagingException {
return getAddressHeader("Sender");
}
Address[] getFrom() throws MessagingException {
Address[] address = getAddressHeader("From");
if (address == null)

@ -95,6 +95,31 @@
app:barrierDirection="bottom"
app:constraint_referenced_ids="ibSearchContact,ibNotifyContact,ibAddContact" />
<TextView
android:id="@+id/tvSubmitterTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:labelFor="@+id/tvSubmitter"
android:text="@string/title_submitter"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier_action" />
<TextView
android:id="@+id/tvSubmitter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Submitter"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/barrier_addresses"
app:layout_constraintTop_toBottomOf="@id/barrier_action" />
<TextView
android:id="@+id/tvFromExTitle"
android:layout_width="wrap_content"
@ -105,7 +130,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier_action" />
app:layout_constraintTop_toBottomOf="@id/tvSubmitter" />
<TextView
android:id="@+id/tvFromEx"
@ -118,7 +143,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/barrier_addresses"
app:layout_constraintTop_toBottomOf="@id/barrier_action" />
app:layout_constraintTop_toBottomOf="@id/tvSubmitter" />
<TextView
android:id="@+id/tvToTitle"

@ -712,6 +712,7 @@
<string name="title_download_message">Downloading &#8230;</string>
<string name="title_compose">Compose</string>
<string name="title_submitter">Sent by:</string>
<string name="title_from">From:</string>
<string name="title_to">To:</string>
<string name="title_reply_to">Reply to:</string>

Loading…
Cancel
Save