admin
2021-02-04 1dccad84f4e90640441f7e824f0bb13ef25720da
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.weikou.beibeivideo.ui.dialog;
 
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
 
import com.alibaba.fastjson.JSONObject;
import com.bumptech.glide.GenericTransitionOptions;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.lcjian.library.util.common.TimeUtil;
import com.weikou.beibeivideo.R;
import com.weikou.beibeivideo.entity.JumpDetail;
import com.weikou.beibeivideo.util.JumpActivityUtil;
 
/**
 * 用户协议弹框
 */
public class VIPDialog extends Dialog {
 
    private static String TAG = VIPDialog.class.getName();
 
    public VIPDialog(Context context) {
        super(context);
        this.setCancelable(false);
    }
 
    public VIPDialog(Context context, int theme) {
        super(context, theme);
        this.setCancelable(false);
    }
 
 
    public static class Builder {
 
 
        private Activity context;
 
        public Builder(Activity context) {
            this.context = context;
        }
 
        private View.OnClickListener closeListener;
 
        private View.OnClickListener upgradeListener;
 
 
        public Builder setCloseListener(View.OnClickListener listener) {
            this.closeListener = listener;
            return this;
        }
 
        public Builder setUpgradeListener(View.OnClickListener listener) {
            this.upgradeListener = listener;
            return this;
        }
 
        public VIPDialog create() {
 
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final VIPDialog dialog = new VIPDialog(context, R.style.Dialog);
            dialog.setCanceledOnTouchOutside(true);
            final View layout = inflater.inflate(R.layout.dialog_vip, null);
            ImageView iv_code = layout.findViewById(R.id.iv_close);
            TextView tv_upgrade = layout.findViewById(R.id.tv_upgrade);
            iv_code.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (closeListener != null)
                        closeListener.onClick(v);
                }
            });
 
            tv_upgrade.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (upgradeListener != null)
                        upgradeListener.onClick(v);
                }
            });
 
 
            dialog.setContentView(layout);
 
            WindowManager.LayoutParams params = dialog.getWindow()
                    .getAttributes();
            params.width = WindowManager.LayoutParams.MATCH_PARENT;
            params.height = WindowManager.LayoutParams.MATCH_PARENT;
            dialog.getWindow().setAttributes(params);
            return dialog;
        }
    }
 
    public interface MeasureCallBack {
        public void onMeasure(int height);
    }
}