package com.itant.joycity.tool;

import android.app.Activity;
import android.app.AlertDialog;
import android.graphics.drawable.ColorDrawable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.itant.joycity.R;

/**
 * Created by Jason on 2016/10/6.
 */
public class DialogTool {

    /**
     * 显示支付的界面
     * @param activity
     * @param url
     */
    public static void showPayDialog(Activity activity, String url, int type) {
        AlertDialog dialog = new AlertDialog.Builder(activity).create();
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable());
        dialog.show();
        dialog.setContentView(R.layout.dialog_pay);
        ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_pay);

        TextView tv_pay_hint = (TextView) dialog.findViewById(R.id.tv_pay_hint);
        switch (type) {
            case 0:
                tv_pay_hint.setText("微信支付");
                break;
            case 1:
                tv_pay_hint.setText("支付宝支付");
                break;
            default:
                break;
        }

        Glide.with(activity)
                .load(url)
                .into(imageView);
    }
}
