1package com.android.mail.compose; 2 3import android.content.Context; 4import android.util.AttributeSet; 5import android.view.LayoutInflater; 6import android.view.ViewGroup; 7import android.widget.ImageButton; 8 9import com.android.mail.R; 10import com.android.mail.providers.Attachment; 11import com.android.mail.ui.AttachmentTile; 12 13public class ComposeAttachmentTile extends AttachmentTile implements AttachmentDeletionInterface { 14 private ImageButton mDeleteButton; 15 16 public ComposeAttachmentTile(Context context) { 17 this(context, null); 18 } 19 20 public ComposeAttachmentTile(Context context, AttributeSet attrs) { 21 super(context, attrs); 22 23 setAlwaysShowInfoText(true); 24 } 25 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 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 39 protected void onFinishInflate() { 40 super.onFinishInflate(); 41 42 mDeleteButton = (ImageButton) findViewById(R.id.attachment_tile_close_button); 43 } 44 45 @Override 46 public void addDeleteListener(OnClickListener clickListener) { 47 mDeleteButton.setOnClickListener(clickListener); 48 } 49} 50