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

View File

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