Show no file type icon if unknown file type

pull/180/head
M66B 5 years ago
parent d628cabf71
commit dcf65d3746

@ -115,7 +115,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(attachment.getMimeType());
if (extension != null)
resid = context.getResources().getIdentifier("file_" + extension, "drawable", context.getPackageName());
ivType.setImageResource(resid == 0 ? R.drawable.baseline_description_24 : resid);
if (resid == 0)
ivType.setImageDrawable(null);
else
ivType.setImageResource(resid);
tvName.setText(attachment.name);

@ -1,10 +0,0 @@
<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="M14,2L6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6zM16,18L8,18v-2h8v2zM16,14L8,14v-2h8v2zM13,9L13,3.5L18.5,9L13,9z"/>
</vector>

@ -33,7 +33,7 @@
app:layout_constraintBottom_toBottomOf="@+id/tvType"
app:layout_constraintStart_toEndOf="@id/ibDelete"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_description_24" />
app:srcCompat="@drawable/file_bin" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvName"

@ -20,7 +20,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_description_24" />
app:srcCompat="@drawable/file_bin" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvName"

Loading…
Cancel
Save