1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Extended EML view

This commit is contained in:
M66B 2019-12-11 08:11:57 +01:00
parent 989f0a0ae2
commit edcdc8e379
2 changed files with 115 additions and 3 deletions

View file

@ -54,6 +54,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.util.List;
import java.util.Properties;
@ -75,8 +76,12 @@ public class ActivityEML extends ActivityBase {
getSupportActionBar().setSubtitle("EML");
setContentView(R.layout.activity_eml);
final TextView tvTo = findViewById(R.id.tvTo);
final TextView tvFrom = findViewById(R.id.tvFrom);
final TextView tvTo = findViewById(R.id.tvTo);
final TextView tvReplyTo = findViewById(R.id.tvReplyTo);
final TextView tvCc = findViewById(R.id.tvCc);
final TextView tvSent = findViewById(R.id.tvSent);
final TextView tvReceived = findViewById(R.id.tvReceived);
final TextView tvSubject = findViewById(R.id.tvSubject);
final View vSeparatorAttachments = findViewById(R.id.vSeparatorAttachments);
final RecyclerView rvAttachment = findViewById(R.id.rvAttachment);
@ -133,6 +138,10 @@ public class ActivityEML extends ActivityBase {
result.from = MessageHelper.formatAddresses(helper.getFrom());
result.to = MessageHelper.formatAddresses(helper.getTo());
result.replyTo = MessageHelper.formatAddresses(helper.getReply());
result.cc = MessageHelper.formatAddresses(helper.getCc());
result.sent = helper.getSent();
result.received = helper.getReceived();
result.subject = helper.getSubject();
result.parts = helper.getMessageParts(context);
@ -148,8 +157,14 @@ public class ActivityEML extends ActivityBase {
@Override
protected void onExecuted(Bundle args, Result result) {
DateFormat DTF = Helper.getDateTimeInstance(ActivityEML.this);
tvFrom.setText(result.from);
tvTo.setText(result.to);
tvReplyTo.setText(result.replyTo);
tvCc.setText(result.cc);
tvSent.setText(result.sent == null ? null : DTF.format(result.sent));
tvReceived.setText(result.received == null ? null : DTF.format(result.received));
tvSubject.setText(result.subject);
vSeparatorAttachments.setVisibility(result.parts.getAttachmentParts().size() > 0 ? View.VISIBLE : View.GONE);
@ -386,6 +401,10 @@ public class ActivityEML extends ActivityBase {
private class Result {
String from;
String to;
String replyTo;
String cc;
Long sent;
Long received;
String subject;
MessageHelper.MessageParts parts;
Spanned body;

View file

@ -81,6 +81,94 @@
app:layout_constraintStart_toEndOf="@id/tvToTitle"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<TextView
android:id="@+id/tvReplyToTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_reply_to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<TextView
android:id="@+id/tvReplyTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Reply to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReplyToTitle"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<TextView
android:id="@+id/tvCcTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_cc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<TextView
android:id="@+id/tvCc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Cc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvCcTitle"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<TextView
android:id="@+id/tvSentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<TextView
android:id="@+id/tvSent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSentTitle"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<TextView
android:id="@+id/tvReceivedTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<TextView
android:id="@+id/tvReceived"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReceivedTitle"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<TextView
android:id="@+id/tvSubject"
android:layout_width="0dp"
@ -91,7 +179,7 @@
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
app:layout_constraintTop_toBottomOf="@id/tvReceived" />
<View
android:id="@+id/vSeparatorAttachments"
@ -139,8 +227,13 @@
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="
vSeparatorHeader,tvFromTitle,tvFrom,
vSeparatorHeader,
tvFromTitle,tvFrom,
tvToTitle,tvTo,
tvReplyToTitle,tvReplyTo,
tvCcTitle,tvCc,
tvSentTitle,tvSent,
tvReceivedTitle,tvReceived,
tvSubject,
rvAttachment,
vSeparatorBody,tvBody" />