1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-05 00:55:08 -05:00

Don't display -1 as attachment size

This commit is contained in:
cketti 2015-02-01 04:24:02 +01:00
parent 474efa1831
commit 19db6c703b

View File

@ -60,8 +60,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
}
private void displayAttachmentInformation() {
TextView attachmentName = (TextView) findViewById(R.id.attachment_name);
TextView attachmentInfo = (TextView) findViewById(R.id.attachment_info);
viewButton = (Button) findViewById(R.id.view);
downloadButton = (Button) findViewById(R.id.download);
@ -74,12 +72,24 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
downloadButton.setOnClickListener(this);
downloadButton.setOnLongClickListener(this);
TextView attachmentName = (TextView) findViewById(R.id.attachment_name);
attachmentName.setText(attachment.displayName);
attachmentInfo.setText(SizeFormatter.formatSize(getContext(), attachment.size));
setAttachmentSize(attachment.size);
refreshThumbnail();
}
private void setAttachmentSize(long size) {
TextView attachmentSize = (TextView) findViewById(R.id.attachment_info);
if (size == AttachmentViewInfo.UNKNOWN_SIZE) {
attachmentSize.setText("");
} else {
String text = SizeFormatter.formatSize(getContext(), size);
attachmentSize.setText(text);
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {