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);
|
}
|
}
|