Show message size

pull/50/head
M66B 6 years ago
parent 9967118a2f
commit 11d787122e

@ -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)

@ -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" />
<TextView
android:id="@+id/tvSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:maxLines="1"
android:text="123 K"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toStartOf="@+id/tvTime"
app:layout_constraintTop_toTopOf="@id/tvFrom" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
@ -269,7 +281,7 @@
android:id="@+id/grpHeader"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvFrom,tvToTitle,tvTo,tvTime,tvSubject" />
app:constraint_referenced_ids="tvFrom,tvToTitle,tvTo,tvSize,tvTime,tvSubject" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAddresses"

Loading…
Cancel
Save