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