Added HTML view to EML viewer

pull/147/head
M66B 6 years ago
parent 38352c1760
commit 8c338924ad

@ -37,6 +37,7 @@ public class ActivityEml extends ActivityBase {
final TextView tvSubject = findViewById(R.id.tvSubject); final TextView tvSubject = findViewById(R.id.tvSubject);
final TextView tvParts = findViewById(R.id.tvParts); final TextView tvParts = findViewById(R.id.tvParts);
final TextView tvBody = findViewById(R.id.tvBody); final TextView tvBody = findViewById(R.id.tvBody);
final TextView tvHtml = findViewById(R.id.tvHtml);
final TextView tvEml = findViewById(R.id.tvEml); final TextView tvEml = findViewById(R.id.tvEml);
final ContentLoadingProgressBar pbWait = findViewById(R.id.pbWait); final ContentLoadingProgressBar pbWait = findViewById(R.id.pbWait);
final Group grpEml = findViewById(R.id.grpEml); final Group grpEml = findViewById(R.id.grpEml);
@ -102,8 +103,8 @@ public class ActivityEml extends ActivityBase {
} }
result.parts = HtmlHelper.fromHtml(sb.toString()); result.parts = HtmlHelper.fromHtml(sb.toString());
String html = HtmlHelper.sanitize(parts.getHtml(context), true); result.html = HtmlHelper.sanitize(parts.getHtml(context), true);
result.body = HtmlHelper.fromHtml(html); result.body = HtmlHelper.fromHtml(result.html);
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
mmessage.writeTo(bos); mmessage.writeTo(bos);
@ -126,6 +127,7 @@ public class ActivityEml extends ActivityBase {
tvSubject.setText(result.subject); tvSubject.setText(result.subject);
tvParts.setText(result.parts); tvParts.setText(result.parts);
tvBody.setText(result.body); tvBody.setText(result.body);
tvHtml.setText(result.html);
tvEml.setText(result.eml); tvEml.setText(result.eml);
grpEml.setVisibility(View.VISIBLE); grpEml.setVisibility(View.VISIBLE);
} }
@ -149,6 +151,7 @@ public class ActivityEml extends ActivityBase {
String subject; String subject;
Spanned parts; Spanned parts;
Spanned body; Spanned body;
String html;
String eml; String eml;
} }
} }

@ -171,7 +171,7 @@
app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" /> app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" />
<View <View
android:id="@+id/vSeparatorEml" android:id="@+id/vSeparatorHtml"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
@ -180,6 +180,28 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBody" /> app:layout_constraintTop_toBottomOf="@id/tvBody" />
<TextView
android:id="@+id/tvHtml"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:fontFamily="monospace"
android:text="HTML"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHtml" />
<View
android:id="@+id/vSeparatorEml"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHtml" />
<TextView <TextView
android:id="@+id/tvEml" android:id="@+id/tvEml"
android:layout_width="0dp" android:layout_width="0dp"
@ -216,6 +238,7 @@
tvSubject, tvSubject,
vSeparatorParts,tvParts, vSeparatorParts,tvParts,
vSeparatorBody,tvBody, vSeparatorBody,tvBody,
vSeparatorHtml,tvHtml,
vSeparatorEml,tvEml" /> vSeparatorEml,tvEml" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
Loading…
Cancel
Save