summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2012-06-25 18:55:00 -0700
committerAndrew Sapperstein <asapperstein@google.com>2012-06-26 12:13:57 -0700
commitafff6d79b4ea2713ef75bfdad8abd7e21ee20080 (patch)
treec258e00b1499a62c5a8bb1cd0af87e135bdae8b9 /src
parentf55099be2a3b49ef76f2cae169813721205ae3d3 (diff)
downloadandroid_packages_apps_UnifiedEmail-afff6d79b4ea2713ef75bfdad8abd7e21ee20080.tar.gz
android_packages_apps_UnifiedEmail-afff6d79b4ea2713ef75bfdad8abd7e21ee20080.tar.bz2
android_packages_apps_UnifiedEmail-afff6d79b4ea2713ef75bfdad8abd7e21ee20080.zip
Updated the UI for attachments per revised mocks.
Now showing name/subtitle when we don't have a preview or if we are in the compose view. Still needs revised assets. Change-Id: Ie522b5dd28b605c8e16793a65a75696c00169fae
Diffstat (limited to 'src')
-rw-r--r--src/com/android/mail/browse/MessageAttachmentTile.java16
-rw-r--r--src/com/android/mail/ui/AttachmentTile.java34
2 files changed, 48 insertions, 2 deletions
diff --git a/src/com/android/mail/browse/MessageAttachmentTile.java b/src/com/android/mail/browse/MessageAttachmentTile.java
index ce93f9a9f..daaa0cf6a 100644
--- a/src/com/android/mail/browse/MessageAttachmentTile.java
+++ b/src/com/android/mail/browse/MessageAttachmentTile.java
@@ -20,6 +20,7 @@ package com.android.mail.browse;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Bitmap;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -50,6 +51,7 @@ public class MessageAttachmentTile extends AttachmentTile implements OnClickList
private int mPhotoIndex;
private Uri mAttachmentsListUri;
+ private View mTextContainer;
private final AttachmentActionHandler mActionHandler;
@@ -92,6 +94,8 @@ public class MessageAttachmentTile extends AttachmentTile implements OnClickList
protected void onFinishInflate() {
super.onFinishInflate();
+ mTextContainer = findViewById(R.id.attachment_tile_text_container);
+
setOnClickListener(this);
}
@@ -137,4 +141,16 @@ public class MessageAttachmentTile extends AttachmentTile implements OnClickList
public void onUpdateStatus() {
}
+
+ @Override
+ public void setThumbnailToDefault() {
+ super.setThumbnailToDefault();
+ mTextContainer.setVisibility(VISIBLE);
+ }
+
+ @Override
+ public void setThumbnail(Bitmap result) {
+ super.setThumbnail(result);
+ mTextContainer.setVisibility(GONE);
+ }
}
diff --git a/src/com/android/mail/ui/AttachmentTile.java b/src/com/android/mail/ui/AttachmentTile.java
index 3383f4603..6f8728848 100644
--- a/src/com/android/mail/ui/AttachmentTile.java
+++ b/src/com/android/mail/ui/AttachmentTile.java
@@ -21,15 +21,18 @@ import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
+import android.widget.TextView;
import com.android.ex.photo.util.ImageUtils;
import com.android.mail.R;
import com.android.mail.providers.Attachment;
import com.android.mail.utils.LogTag;
+import com.android.mail.utils.AttachmentUtils;
import com.android.mail.utils.LogUtils;
/**
@@ -41,6 +44,10 @@ public class AttachmentTile extends RelativeLayout implements AttachmentBitmapHo
private ImageView mIcon;
private ImageView.ScaleType mIconScaleType;
private ThumbnailLoadTask mThumbnailTask;
+ private TextView mTitle;
+ private TextView mSubtitle;
+ private String mAttachmentSizeText;
+ private String mDisplayType;
private static final String LOG_TAG = LogTag.getLogTag();
@@ -66,6 +73,8 @@ public class AttachmentTile extends RelativeLayout implements AttachmentBitmapHo
protected void onFinishInflate() {
super.onFinishInflate();
+ mTitle = (TextView) findViewById(R.id.attachment_tile_title);
+ mSubtitle = (TextView) findViewById(R.id.attachment_tile_subtitle);
mIcon = (ImageView) findViewById(R.id.attachment_tile_image);
mIconScaleType = mIcon.getScaleType();
}
@@ -90,12 +99,33 @@ public class AttachmentTile extends RelativeLayout implements AttachmentBitmapHo
attachment.destination, attachment.downloadedSize, attachment.contentUri,
attachment.contentType);
+ if (prevAttachment == null || TextUtils.equals(attachment.name, prevAttachment.name)) {
+ mTitle.setText(attachment.name);
+ }
+
+ if (prevAttachment == null || attachment.size != prevAttachment.size) {
+ mAttachmentSizeText = AttachmentUtils.convertToHumanReadableSize(getContext(),
+ attachment.size);
+ mDisplayType = AttachmentUtils.getDisplayType(getContext(), attachment);
+ updateSubtitleText();
+ }
+
ThumbnailLoadTask.setupThumbnailPreview(mThumbnailTask, this, attachment, prevAttachment);
}
+ private void updateSubtitleText() {
+ // TODO: make this a formatted resource when we have a UX design.
+ // not worth translation right now.
+ StringBuilder sb = new StringBuilder();
+ sb.append(mAttachmentSizeText);
+ sb.append(' ');
+ sb.append(mDisplayType);
+ mSubtitle.setText(sb.toString());
+ }
+
public void setThumbnailToDefault() {
- mIcon.setImageResource(R.drawable.ic_menu_attachment_holo_light);
- mIcon.setScaleType(ImageView.ScaleType.CENTER);
+ mIcon.setImageResource(R.drawable.ic_attach_picture_holo_light);
+ mIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
public void setThumbnail(Bitmap result) {