Extended EML view

pull/169/head
M66B 6 years ago
parent 989f0a0ae2
commit edcdc8e379

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

@ -81,6 +81,94 @@
app:layout_constraintStart_toEndOf="@id/tvToTitle" app:layout_constraintStart_toEndOf="@id/tvToTitle"
app:layout_constraintTop_toBottomOf="@id/tvFrom" /> 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 <TextView
android:id="@+id/tvSubject" android:id="@+id/tvSubject"
android:layout_width="0dp" android:layout_width="0dp"
@ -91,7 +179,7 @@
android:textStyle="italic" android:textStyle="italic"
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/tvTo" /> app:layout_constraintTop_toBottomOf="@id/tvReceived" />
<View <View
android:id="@+id/vSeparatorAttachments" android:id="@+id/vSeparatorAttachments"
@ -139,8 +227,13 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids=" app:constraint_referenced_ids="
vSeparatorHeader,tvFromTitle,tvFrom, vSeparatorHeader,
tvFromTitle,tvFrom,
tvToTitle,tvTo, tvToTitle,tvTo,
tvReplyToTitle,tvReplyTo,
tvCcTitle,tvCc,
tvSentTitle,tvSent,
tvReceivedTitle,tvReceived,
tvSubject, tvSubject,
rvAttachment, rvAttachment,
vSeparatorBody,tvBody" /> vSeparatorBody,tvBody" />

Loading…
Cancel
Save