1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Refresh thumbnail after downloading attachment

This commit is contained in:
cketti 2015-01-19 23:08:41 +01:00
parent 9363c5b276
commit a7b16c1210
4 changed files with 19 additions and 6 deletions

View File

@ -92,6 +92,7 @@ public class AttachmentController {
downloadAttachment(localPart, new Runnable() { downloadAttachment(localPart, new Runnable() {
@Override @Override
public void run() { public void run() {
messageViewFragment.refreshAttachmentThumbnail(attachment);
saveAttachmentTo(directory); saveAttachmentTo(directory);
} }
}); });

View File

@ -77,12 +77,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
attachmentName.setText(attachment.displayName); attachmentName.setText(attachment.displayName);
attachmentInfo.setText(SizeFormatter.formatSize(getContext(), attachment.size)); attachmentInfo.setText(SizeFormatter.formatSize(getContext(), attachment.size));
ImageView thumbnailView = (ImageView) findViewById(R.id.attachment_icon); refreshThumbnail();
Glide.with(getContext())
.load(attachment.uri)
.placeholder(R.drawable.attached_image_placeholder)
.centerCrop()
.into(thumbnailView);
} }
@Override @Override
@ -124,4 +119,13 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
public void setCallback(AttachmentViewCallback callback) { public void setCallback(AttachmentViewCallback callback) {
this.callback = callback; this.callback = callback;
} }
public void refreshThumbnail() {
ImageView thumbnailView = (ImageView) findViewById(R.id.attachment_icon);
Glide.with(getContext())
.load(attachment.uri)
.placeholder(R.drawable.attached_image_placeholder)
.centerCrop()
.into(thumbnailView);
}
} }

View File

@ -694,6 +694,10 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
}); });
} }
public void refreshAttachmentThumbnail(AttachmentViewInfo attachment) {
mMessageView.refreshAttachmentThumbnail(attachment);
}
public interface MessageViewFragmentListener { public interface MessageViewFragmentListener {
public void onForward(LocalMessage mMessage, PgpData mPgpData); public void onForward(LocalMessage mMessage, PgpData mPgpData);
public void disableDeleteAction(); public void disableDeleteAction();

View File

@ -721,6 +721,10 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
getAttachmentView(attachment).disableButtons(); getAttachmentView(attachment).disableButtons();
} }
public void refreshAttachmentThumbnail(AttachmentViewInfo attachment) {
getAttachmentView(attachment).refreshThumbnail();
}
private AttachmentView getAttachmentView(AttachmentViewInfo attachment) { private AttachmentView getAttachmentView(AttachmentViewInfo attachment) {
return attachments.get(attachment); return attachments.get(attachment);
} }