-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStickerImageView.java
63 lines (47 loc) · 1.52 KB
/
StickerImageView.java
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
52
53
54
55
56
57
58
59
60
61
62
63
package com.greentown.emmarpublicity.stickerview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
public class StickerImageView extends StickerView {
private String owner_id;
private ImageView iv_main;
public StickerImageView(Context context) {
super(context);
}
public StickerImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public StickerImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setOwnerId(String owner_id) {
this.owner_id = owner_id;
}
public String getOwnerId() {
return this.owner_id;
}
@Override
public View getMainView() {
if (this.iv_main == null) {
this.iv_main = new ImageView(getContext());
this.iv_main.setScaleType(ImageView.ScaleType.FIT_XY);
}
return iv_main;
}
public void setImageBitmap(Bitmap bmp) {
this.iv_main.setImageBitmap(bmp);
}
public void setImageResource(int res_id) {
this.iv_main.setImageResource(res_id);
}
public void setImageDrawable(Drawable drawable) {
this.iv_main.setImageDrawable(drawable);
}
public Bitmap getImageBitmap() {
return ((BitmapDrawable) this.iv_main.getDrawable()).getBitmap();
}
}