Show disposition icon

pull/183/head
M66B 5 years ago
parent 198f978c9c
commit 1d57f98f28

@ -49,6 +49,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.mail.Part;
public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.ViewHolder> {
private Fragment parentFragment;
@ -65,6 +67,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
private View view;
private ImageButton ibDelete;
private ImageView ivType;
private ImageView ivDisposition;
private TextView tvName;
private TextView tvSize;
private ImageView ivStatus;
@ -84,6 +87,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
ivStatus = itemView.findViewById(R.id.ivStatus);
ibSave = itemView.findViewById(R.id.ibSave);
tvType = itemView.findViewById(R.id.tvType);
ivDisposition = itemView.findViewById(R.id.ivDisposition);
tvError = itemView.findViewById(R.id.tvError);
progressbar = itemView.findViewById(R.id.progressbar);
}
@ -114,6 +118,12 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
else
ivType.setImageResource(resid);
ivDisposition.setImageLevel(Part.INLINE.equals(attachment.disposition) ? 1 : 0);
ivDisposition.setVisibility(
Part.ATTACHMENT.equals(attachment.disposition) ||
Part.INLINE.equals(attachment.disposition)
? View.VISIBLE : View.INVISIBLE);
tvName.setText(attachment.name);
if (attachment.size != null)
@ -140,9 +150,9 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
StringBuilder sb = new StringBuilder();
sb.append(attachment.type);
if (attachment.disposition != null)
sb.append(' ').append(attachment.disposition);
if (debug || BuildConfig.DEBUG) {
if (attachment.disposition != null)
sb.append(' ').append(attachment.disposition);
if (attachment.cid != null)
sb.append(' ').append(attachment.cid);
if (attachment.isEncryption())

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/baseline_attachment_24"
android:maxLevel="0" />
<item
android:drawable="@drawable/baseline_code_24"
android:maxLevel="1" />
</level-list>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
</vector>

@ -37,6 +37,15 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/file_bin" />
<ImageView
android:id="@+id/ivDisposition"
android:layout_width="12dp"
android:layout_height="12dp"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="@id/ivType"
app:layout_constraintTop_toTopOf="@+id/ivType"
app:srcCompat="@drawable/attachment_disposition" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvName"
android:layout_width="0dp"
@ -105,13 +114,11 @@
android:id="@+id/tvError"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Error"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintStart_toStartOf="@id/tvName"
app:layout_constraintTop_toBottomOf="@id/tvType" />
<ProgressBar

Loading…
Cancel
Save