forked from razerdp/BasePopup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SlideFromBottomPopup.java
65 lines (53 loc) · 1.67 KB
/
SlideFromBottomPopup.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
64
65
package razerdp.demo.popup;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import razerdp.basepopup.BasePopupWindow;
import razerdp.basepopup.R;
import razerdp.demo.utils.ToastUtils;
/**
* Created by 大灯泡 on 2016/1/15.
* 从底部滑上来的popup
*/
public class SlideFromBottomPopup extends BasePopupWindow implements View.OnClickListener {
private View popupView;
public SlideFromBottomPopup(Context context) {
super(context);
setPopupGravity(Gravity.BOTTOM);
bindEvent();
}
@Override
protected Animation onCreateShowAnimation() {
return getTranslateVerticalAnimation(1f, 0, 500);
}
@Override
protected Animation onCreateDismissAnimation() {
return getTranslateVerticalAnimation(0, 1f, 500);
}
@Override
public View onCreateContentView() {
return createPopupById(R.layout.popup_slide_from_bottom);
}
private void bindEvent() {
findViewById(R.id.tx_1).setOnClickListener(this);
findViewById(R.id.tx_2).setOnClickListener(this);
findViewById(R.id.tx_3).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tx_1:
ToastUtils.ToastMessage(getContext(), "click tx_1");
break;
case R.id.tx_2:
ToastUtils.ToastMessage(getContext(), "click tx_2");
break;
case R.id.tx_3:
ToastUtils.ToastMessage(getContext(), "click tx_3");
break;
default:
break;
}
}
}