1 package com.android.mail.compose; 2 3 import android.content.Context; 4 import android.util.AttributeSet; 5 import android.view.LayoutInflater; 6 import android.view.ViewGroup; 7 import android.widget.ImageButton; 8 9 import com.android.mail.R; 10 import com.android.mail.providers.Attachment; 11 import com.android.mail.ui.AttachmentTile; 12 13 public class ComposeAttachmentTile extends AttachmentTile implements AttachmentDeletionInterface { 14 private ImageButton mDeleteButton; 15 ComposeAttachmentTile(Context context)16 public ComposeAttachmentTile(Context context) { 17 this(context, null); 18 } 19 ComposeAttachmentTile(Context context, AttributeSet attrs)20 public ComposeAttachmentTile(Context context, AttributeSet attrs) { 21 super(context, attrs); 22 23 setAlwaysShowInfoText(true); 24 } 25 inflate(LayoutInflater inflater, ViewGroup parent)26 public static ComposeAttachmentTile inflate(LayoutInflater inflater, ViewGroup parent) { 27 ComposeAttachmentTile view = (ComposeAttachmentTile) inflater.inflate( 28 R.layout.compose_attachment_tile, parent, false); 29 return view; 30 } 31 32 @Override render(Attachment attachment, AttachmentPreviewCache attachmentPreviewCache)33 public void render(Attachment attachment, AttachmentPreviewCache attachmentPreviewCache) { 34 // the super implementation is good enough. just broaden its access. 35 super.render(attachment, attachmentPreviewCache); 36 } 37 38 @Override onFinishInflate()39 protected void onFinishInflate() { 40 super.onFinishInflate(); 41 42 mDeleteButton = (ImageButton) findViewById(R.id.attachment_tile_close_button); 43 } 44 45 @Override addDeleteListener(OnClickListener clickListener)46 public void addDeleteListener(OnClickListener clickListener) { 47 mDeleteButton.setOnClickListener(clickListener); 48 } 49 } 50