diff --git a/app/src/main/java/eu/faircode/email/FragmentMessage.java b/app/src/main/java/eu/faircode/email/FragmentMessage.java
index 9308a286d6..e3e753b100 100644
--- a/app/src/main/java/eu/faircode/email/FragmentMessage.java
+++ b/app/src/main/java/eu/faircode/email/FragmentMessage.java
@@ -72,6 +72,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class FragmentMessage extends FragmentEx {
private ViewGroup view;
private TextView tvFrom;
+ private TextView tvSize;
private TextView tvTime;
private TextView tvTo;
private TextView tvSubject;
@@ -112,6 +113,7 @@ public class FragmentMessage extends FragmentEx {
// Get controls
tvFrom = view.findViewById(R.id.tvFrom);
+ tvSize = view.findViewById(R.id.tvSize);
tvTime = view.findViewById(R.id.tvTime);
tvTo = view.findViewById(R.id.tvTo);
tvSubject = view.findViewById(R.id.tvSubject);
@@ -261,6 +263,8 @@ public class FragmentMessage extends FragmentEx {
fab.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
+ tvSize.setText(null);
+
rvAttachment.setHasFixedSize(false);
LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvAttachment.setLayoutManager(llm);
@@ -329,11 +333,13 @@ public class FragmentMessage extends FragmentEx {
@Override
protected Spanned onLoad(Context context, Bundle args) throws Throwable {
String body = EntityMessage.read(context, args.getLong("id"));
+ args.putInt("size", body.length());
return Html.fromHtml(HtmlHelper.sanitize(getContext(), body, false));
}
@Override
protected void onLoaded(Bundle args, Spanned body) {
+ tvSize.setText(Helper.humanReadableByteCount(args.getInt("size"), false));
tvBody.setText(body);
grpMessage.setVisibility(View.VISIBLE);
if (!free)
diff --git a/app/src/main/res/layout/fragment_message.xml b/app/src/main/res/layout/fragment_message.xml
index d1e992ab8d..05f5f087c0 100644
--- a/app/src/main/res/layout/fragment_message.xml
+++ b/app/src/main/res/layout/fragment_message.xml
@@ -17,10 +17,22 @@
android:text="From"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
- app:layout_constraintEnd_toStartOf="@+id/tvTime"
+ app:layout_constraintEnd_toStartOf="@+id/tvSize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
+
+ app:constraint_referenced_ids="tvFrom,tvToTitle,tvTo,tvSize,tvTime,tvSubject" />