// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/utils/Adaptation.java
// public class Adaptation {
// 
//     public static int screenHeight = 0;
//     public static int screenWidth = 0;
//     public static float screenDensity = 0;
//     public static int densityDpi = 0;
//     // public static int version = Integer.valueOf(android.os.Build.VERSION.SDK_INT);
// 
//     public static final int SCREEN_9_16 = 1;    // 9:16
//     public static final int SCREEN_3_4 = 2;     // 3:4
//     public static final int SCREEN_4_3 = 3;     // 4:3
//     public static final int SCREEN_16_9 = 4;    // 16:9
//     public static int proportion = SCREEN_9_16;
// 
//     // public static final float PROPORTION_9_16 = 0.56f;    // 9:16
//     // public static final float PROPORTION_3_4 = 0.75f;     // 3:4
//     // public static final float PROPORTION_4_3 = 1.33f;     // 4:3
//     // public static final float PROPORTION_16_9 = 1.77f;    // 16:9
// 
//     public static final float AVERAGE1 = 0.655f;    // (9:16+3:4)/2
//     public static final float AVERAGE2 = 1.04f;     // (3:4+4:3)/2
//     public static final float AVERAGE3 = 1.55f;     // (4:3+16:9)/2
// 
//     public static void init(Context context) {
//         if (screenDensity == 0 || screenWidth == 0 || screenHeight == 0) {
//             DisplayMetrics dm = new DisplayMetrics();
//             WindowManager wm = (WindowManager) context
//                     .getSystemService(Context.WINDOW_SERVICE);
//             wm.getDefaultDisplay().getMetrics(dm);
//             Adaptation.screenDensity = dm.density;
//             Adaptation.screenHeight = dm.heightPixels;
//             Adaptation.screenWidth = dm.widthPixels;
//             Adaptation.densityDpi = dm.densityDpi;
//         }
// 
//         float proportionF = (float) screenWidth / (float) screenHeight;
// 
//         if (proportionF <= AVERAGE1) {
//             proportion = SCREEN_9_16;
//         } else if (proportionF <= AVERAGE2) {
//             proportion = SCREEN_3_4;
//         } else if (proportionF <= AVERAGE3) {
//             proportion = SCREEN_4_3;
//         } else if (proportionF > AVERAGE3) {
//             proportion = SCREEN_16_9;
//         }
// 
//         Log.i("SCREEN CONFIG", "screenHeight:" + screenHeight + ";screenWidth:"
//                 + screenWidth + ";screenDensity:" + screenDensity
//                 + ";densityDpi:" + densityDpi);
// 
//     }
// 
// }


import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import sunmi.sunmiui.R;
import sunmi.sunmiui.utils.Adaptation;
package sunmi.sunmiui.dialog;



/**
 * 两个按钮，一个icon，一个title的dialog，如果第四个参数（textRight）传null，则为单按钮的弹框，第七个参数（right）也应传null
 *
 * @author tomcat
 */
public class DialogCreater {

    public static HintDialog createHintDialog(Context context, int iconId, String textLeft, String textRight, String message, View.OnClickListener left, View.OnClickListener right,boolean isSystem) {
        HintDialog dialogProxy = HintDialog.getInstance();
        if (dialogProxy.hasDialog()) {
            return dialogProxy;
        }
        Dialog dialog = setHintDialogContentView(context);
        ImageView img = (ImageView) dialog.findViewById(R.id.img);
        img.setImageResource(iconId);
        TextView tvMsg = (TextView) dialog.findViewById(R.id.content);
        TextView btnLeft = (TextView) dialog.findViewById(R.id.left);
        TextView btnRight = (TextView) dialog.findViewById(R.id.right);
        tvMsg.setText(message);
        btnLeft.setText(textLeft);
        btnLeft.setOnClickListener(left);
        if(isSystem){
            dialogProxy.setSystemDialog(dialog);
        }else {
            dialogProxy.setDialog(dialog);
        }
        View line = dialog.findViewById(R.id.line2);

        if (TextUtils.isEmpty(textRight)) {
            btnRight.setVisibility(View.GONE);
            line.setVisibility(View.GONE);
// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/utils/Adaptation.java
// public class Adaptation {
// 
//     public static int screenHeight = 0;
//     public static int screenWidth = 0;
//     public static float screenDensity = 0;
//     public static int densityDpi = 0;
//     // public static int version = Integer.valueOf(android.os.Build.VERSION.SDK_INT);
// 
//     public static final int SCREEN_9_16 = 1;    // 9:16
//     public static final int SCREEN_3_4 = 2;     // 3:4
//     public static final int SCREEN_4_3 = 3;     // 4:3
//     public static final int SCREEN_16_9 = 4;    // 16:9
//     public static int proportion = SCREEN_9_16;
// 
//     // public static final float PROPORTION_9_16 = 0.56f;    // 9:16
//     // public static final float PROPORTION_3_4 = 0.75f;     // 3:4
//     // public static final float PROPORTION_4_3 = 1.33f;     // 4:3
//     // public static final float PROPORTION_16_9 = 1.77f;    // 16:9
// 
//     public static final float AVERAGE1 = 0.655f;    // (9:16+3:4)/2
//     public static final float AVERAGE2 = 1.04f;     // (3:4+4:3)/2
//     public static final float AVERAGE3 = 1.55f;     // (4:3+16:9)/2
// 
//     public static void init(Context context) {
//         if (screenDensity == 0 || screenWidth == 0 || screenHeight == 0) {
//             DisplayMetrics dm = new DisplayMetrics();
//             WindowManager wm = (WindowManager) context
//                     .getSystemService(Context.WINDOW_SERVICE);
//             wm.getDefaultDisplay().getMetrics(dm);
//             Adaptation.screenDensity = dm.density;
//             Adaptation.screenHeight = dm.heightPixels;
//             Adaptation.screenWidth = dm.widthPixels;
//             Adaptation.densityDpi = dm.densityDpi;
//         }
// 
//         float proportionF = (float) screenWidth / (float) screenHeight;
// 
//         if (proportionF <= AVERAGE1) {
//             proportion = SCREEN_9_16;
//         } else if (proportionF <= AVERAGE2) {
//             proportion = SCREEN_3_4;
//         } else if (proportionF <= AVERAGE3) {
//             proportion = SCREEN_4_3;
//         } else if (proportionF > AVERAGE3) {
//             proportion = SCREEN_16_9;
//         }
// 
//         Log.i("SCREEN CONFIG", "screenHeight:" + screenHeight + ";screenWidth:"
//                 + screenWidth + ";screenDensity:" + screenDensity
//                 + ";densityDpi:" + densityDpi);
// 
//     }
// 
// }


// Path: SunmiDesign/sunmiui/src/main/java/sunmi/sunmiui/dialog/DialogCreater.java
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import sunmi.sunmiui.R;
import sunmi.sunmiui.utils.Adaptation;

package sunmi.sunmiui.dialog;



/**
 * 两个按钮，一个icon，一个title的dialog，如果第四个参数（textRight）传null，则为单按钮的弹框，第七个参数（right）也应传null
 *
 * @author tomcat
 */
public class DialogCreater {

    public static HintDialog createHintDialog(Context context, int iconId, String textLeft, String textRight, String message, View.OnClickListener left, View.OnClickListener right,boolean isSystem) {
        HintDialog dialogProxy = HintDialog.getInstance();
        if (dialogProxy.hasDialog()) {
            return dialogProxy;
        }
        Dialog dialog = setHintDialogContentView(context);
        ImageView img = (ImageView) dialog.findViewById(R.id.img);
        img.setImageResource(iconId);
        TextView tvMsg = (TextView) dialog.findViewById(R.id.content);
        TextView btnLeft = (TextView) dialog.findViewById(R.id.left);
        TextView btnRight = (TextView) dialog.findViewById(R.id.right);
        tvMsg.setText(message);
        btnLeft.setText(textLeft);
        btnLeft.setOnClickListener(left);
        if(isSystem){
            dialogProxy.setSystemDialog(dialog);
        }else {
            dialogProxy.setDialog(dialog);
        }
        View line = dialog.findViewById(R.id.line2);

        if (TextUtils.isEmpty(textRight)) {
            btnRight.setVisibility(View.GONE);
            line.setVisibility(View.GONE);
            if (Adaptation.proportion == Adaptation.SCREEN_9_16) {