Always show attachment content type

This commit is contained in:
M66B 2019-01-10 10:42:39 +00:00
parent c55c4c5363
commit e55ed8cc70
2 changed files with 31 additions and 12 deletions

View File

@ -71,10 +71,11 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
View itemView;
ImageView ivDelete;
TextView tvName;
TextView tvType;
TextView tvSize;
ImageView ivStatus;
ImageView ivSave;
TextView tvType;
TextView tvDebug;
ProgressBar progressbar;
ViewHolder(View itemView) {
@ -83,10 +84,11 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
this.itemView = itemView;
ivDelete = itemView.findViewById(R.id.ivDelete);
tvName = itemView.findViewById(R.id.tvName);
tvType = itemView.findViewById(R.id.tvType);
tvSize = itemView.findViewById(R.id.tvSize);
ivStatus = itemView.findViewById(R.id.ivStatus);
ivSave = itemView.findViewById(R.id.ivSave);
tvType = itemView.findViewById(R.id.tvType);
tvDebug = itemView.findViewById(R.id.tvDebug);
progressbar = itemView.findViewById(R.id.progressbar);
}
@ -107,6 +109,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
ivDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE);
tvName.setText(attachment.name);
tvType.setText(attachment.type);
if (attachment.size != null)
tvSize.setText(Helper.humanReadableByteCount(attachment.size, true));
@ -130,8 +133,8 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
progressbar.setVisibility(
attachment.progress == null || attachment.available ? View.GONE : View.VISIBLE);
tvType.setText(attachment.type + " " + attachment.disposition + " " + attachment.cid + " " + attachment.encryption);
tvType.setVisibility(debug ? View.VISIBLE : View.GONE);
tvDebug.setText(attachment.type + " " + attachment.disposition + " " + attachment.cid + " " + attachment.encryption);
tvDebug.setVisibility(debug ? View.VISIBLE : View.GONE);
}
@Override

View File

@ -3,8 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:layout_marginTop="6dp">
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp">
<ImageView
android:id="@+id/ivDelete"
@ -25,7 +25,7 @@
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="end"
@ -33,10 +33,25 @@
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@+id/tvSize"
app:layout_constraintEnd_toStartOf="@+id/tvType"
app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<TextView
android:id="@+id/tvType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="start"
android:gravity="end"
android:singleLine="true"
android:text="text/plain"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@id/tvSize"
app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<TextView
android:id="@+id/tvSize"
android:layout_width="wrap_content"
@ -46,7 +61,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@+id/ivStatus"
app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintStart_toEndOf="@id/tvType"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<ImageView
@ -70,12 +85,13 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvType"
android:id="@+id/tvDebug"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="text/plain"
android:text="debug"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="@id/ivStatus"
app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toBottomOf="@id/ivAttachments" />
@ -88,5 +104,5 @@
android:progress="50"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvType" />
app:layout_constraintTop_toBottomOf="@id/tvDebug" />
</androidx.constraintlayout.widget.ConstraintLayout>