// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/utils/BitmapUtil.java
// public class BitmapUtil {
//     public static Bitmap stringtoBitmap(String string) {
//         //将字符串转换成Bitmap类型
//         Bitmap bitmap = null;
//         try {
//             byte[] bitmapArray;
//             bitmapArray = Base64.decode(string, Base64.DEFAULT);
//             bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
//         } catch (Exception e) {
//             e.printStackTrace();
//         }
// 
//         return bitmap;
//     }
// 
// 
//     public static String bitmaptoString(Bitmap bitmap) {
//         //将Bitmap转换成字符串
//         String string = null;
//         ByteArrayOutputStream bStream = new ByteArrayOutputStream();
//         bitmap.compress(Bitmap.CompressFormat.PNG, 100, bStream);
//         byte[] bytes = bStream.toByteArray();
//         string = Base64.encodeToString(bytes, Base64.DEFAULT);
//         return string;
//     }
// }


import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import sunmi.sunmiui.R;
import sunmi.sunmiui.utils.BitmapUtil;
        }
        return instance;
    }

    @Override
    protected void init() {
        title = (TextView) dialog.findViewById(R.id.txt);
        code = (ImageView) dialog.findViewById(R.id.code);
        editText = (EditText) dialog.findViewById(R.id.editText);
        clear = (ImageView) dialog.findViewById(R.id.clear);
        load = (ImageView) dialog.findViewById(R.id.load);
        error = (TextView) dialog.findViewById(R.id.txt_error);
        clear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                editText.setText("");
            }
        });
        error.setVisibility(View.GONE);
        load.setVisibility(View.GONE);
        clear.setVisibility(View.GONE);
    }

    public void setData(String titleString, String imgBase64, final CodeInputSuccess listener, View.OnClickListener incodeOnClickListener) {
        isReq = false;
        error.setVisibility(View.GONE);
        load.clearAnimation();
        load.setVisibility(View.GONE);
        clear.setVisibility(View.GONE);
        title.setText(titleString);
// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/utils/BitmapUtil.java
// public class BitmapUtil {
//     public static Bitmap stringtoBitmap(String string) {
//         //将字符串转换成Bitmap类型
//         Bitmap bitmap = null;
//         try {
//             byte[] bitmapArray;
//             bitmapArray = Base64.decode(string, Base64.DEFAULT);
//             bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
//         } catch (Exception e) {
//             e.printStackTrace();
//         }
// 
//         return bitmap;
//     }
// 
// 
//     public static String bitmaptoString(Bitmap bitmap) {
//         //将Bitmap转换成字符串
//         String string = null;
//         ByteArrayOutputStream bStream = new ByteArrayOutputStream();
//         bitmap.compress(Bitmap.CompressFormat.PNG, 100, bStream);
//         byte[] bytes = bStream.toByteArray();
//         string = Base64.encodeToString(bytes, Base64.DEFAULT);
//         return string;
//     }
// }


// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/dialog/CodeDialog.java
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import sunmi.sunmiui.R;
import sunmi.sunmiui.utils.BitmapUtil;

        }
        return instance;
    }

    @Override
    protected void init() {
        title = (TextView) dialog.findViewById(R.id.txt);
        code = (ImageView) dialog.findViewById(R.id.code);
        editText = (EditText) dialog.findViewById(R.id.editText);
        clear = (ImageView) dialog.findViewById(R.id.clear);
        load = (ImageView) dialog.findViewById(R.id.load);
        error = (TextView) dialog.findViewById(R.id.txt_error);
        clear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                editText.setText("");
            }
        });
        error.setVisibility(View.GONE);
        load.setVisibility(View.GONE);
        clear.setVisibility(View.GONE);
    }

    public void setData(String titleString, String imgBase64, final CodeInputSuccess listener, View.OnClickListener incodeOnClickListener) {
        isReq = false;
        error.setVisibility(View.GONE);
        load.clearAnimation();
        load.setVisibility(View.GONE);
        clear.setVisibility(View.GONE);
        title.setText(titleString);
        code.setImageBitmap(BitmapUtil.stringtoBitmap(imgBase64));