package com.zhilin.patrol.tool;

import android.app.Activity;
import android.text.TextUtils;
import android.view.View;

import com.zhilin.patrol.R;
import com.zhilin.patrol.ui.activity.LoginActivity;
import com.zhilin.patrol.views.AlertDialog;

/**
 * 弹框帮助类
 */
public class DialogUtil {

    /**
     * 网络失败提示
     *
     * @param activity
     */
    public static void showNetFailDialog(Activity activity) {
        new AlertDialog(activity).builder()
                .setTitle(activity.getString(R.string.tv_tishi))
                .setMsg(activity.getString(R.string.tv_error))
                .setNegativeButton(activity.getString(R.string.ok), new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                }).show();
    }

    /**
     * 显示错误信息
     *
     * @param activity
     * @param errText
     */
    public static void showErrDialog(Activity activity, String errText) {
        if (TextUtils.isEmpty(errText)) return;
        new AlertDialog(activity).builder()
                .setTitle(activity.getString(R.string.tv_tishi))
                .setMsg(errText)
                .setNegativeButton(activity.getString(R.string.ok), new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                }).show();
    }

}
