ConversationAdapter: do not show file icon when file has been deleted

This commit is contained in:
Daniel Gultsch 2017-11-21 12:40:42 +01:00
parent 28e005f926
commit 9548a4f6af

View file

@ -79,9 +79,8 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
convName.setTypeface(null, Typeface.NORMAL); convName.setTypeface(null, Typeface.NORMAL);
} }
if (message.getFileParams().width > 0 final boolean fileAvailable = message.getTransferable() == null || message.getTransferable().getStatus() != Transferable.STATUS_DELETED;
&& (message.getTransferable() == null if (message.getFileParams().width > 0 && fileAvailable) {
|| message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
mSenderName.setVisibility(View.GONE); mSenderName.setVisibility(View.GONE);
mLastMessage.setVisibility(View.GONE); mLastMessage.setVisibility(View.GONE);
mLastMessageImage.setVisibility(View.GONE); mLastMessageImage.setVisibility(View.GONE);
@ -89,7 +88,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
activity.loadBitmap(message, imagePreview); activity.loadBitmap(message, imagePreview);
} else { } else {
final boolean showPreviewText; final boolean showPreviewText;
if (message.getType() == Message.TYPE_FILE) { if (message.getType() == Message.TYPE_FILE && fileAvailable) {
if (message.getFileParams().runtime > 0) { if (message.getFileParams().runtime > 0) {
showPreviewText = false; showPreviewText = false;
mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_record, R.drawable.ic_attach_record)); mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_record, R.drawable.ic_attach_record));