1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -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() { 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); viewButton = (Button) findViewById(R.id.view);
downloadButton = (Button) findViewById(R.id.download); downloadButton = (Button) findViewById(R.id.download);
@ -74,12 +72,24 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
downloadButton.setOnClickListener(this); downloadButton.setOnClickListener(this);
downloadButton.setOnLongClickListener(this); downloadButton.setOnLongClickListener(this);
TextView attachmentName = (TextView) findViewById(R.id.attachment_name);
attachmentName.setText(attachment.displayName); attachmentName.setText(attachment.displayName);
attachmentInfo.setText(SizeFormatter.formatSize(getContext(), attachment.size));
setAttachmentSize(attachment.size);
refreshThumbnail(); 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 @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {