// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java
// public class AlertDialogUtils {
// 
//     private AlertDialogUtils() {
//         //no instance
//     }
// 
//     /**
//      * 获取警告对话框主题
//      *
//      * @param context Context
//      * @return 主题
//      */
//     public static int getAlertDialogTheme(Context context) {
//         final TypedValue outValue = new TypedValue();
//         context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme,
//                 outValue, true);
//         return outValue.resourceId;
//     }
// }
// 
// Path: app/src/main/java/am/project/x/utils/StringUtils.java
// @SuppressWarnings("unused")
// public class StringUtils {
// 
//     /**
//      * 字符串匹配
//      *
//      * @param src 源
//      * @param des 匹配样式
//      * @return 是否匹配
//      */
//     public static boolean isMatching(@NonNull String src, @NonNull String des) {
//         String regex = des.replace("*", "\\w*").replace("?", "\\w{1}");
//         return Pattern.compile(regex).matcher(src).matches();
//     }
// 
//     /**
//      * 判断是否是一个IP
//      *
//      * @param IP 字符串
//      * @return 是否是一个IP
//      */
//     public static boolean isIp(@NonNull String IP) {
//         boolean b = false;
//         IP = IP.trim();
//         while (IP.startsWith(" ")) {
//             IP = IP.substring(1).trim();
//         }
//         while (IP.endsWith(" ")) {
//             IP = IP.substring(0, IP.length() - 1).trim();
//         }
//         if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) {
//             String s[] = IP.split("\\.");
//             if (Integer.parseInt(s[0]) < 255)
//                 if (Integer.parseInt(s[1]) < 255)
//                     if (Integer.parseInt(s[2]) < 255)
//                         if (Integer.parseInt(s[3]) < 255)
//                             b = true;
//         }
//         return b;
//     }
// }


import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import am.project.x.R;
import am.project.x.utils.AlertDialogUtils;
import am.project.x.utils.StringUtils;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDialog;
import com.am.tool.support.utils.InputMethodUtils;
/*
 * Copyright (C) 2018 AlexMofer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package am.project.x.business.others.printer;




/**
 * 固定IP填写对话框
 */
class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener {

    private final OnDialogListener mListener;
    private final EditText mVIp;
    private final EditText mVPort;

    PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java
// public class AlertDialogUtils {
// 
//     private AlertDialogUtils() {
//         //no instance
//     }
// 
//     /**
//      * 获取警告对话框主题
//      *
//      * @param context Context
//      * @return 主题
//      */
//     public static int getAlertDialogTheme(Context context) {
//         final TypedValue outValue = new TypedValue();
//         context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme,
//                 outValue, true);
//         return outValue.resourceId;
//     }
// }
// 
// Path: app/src/main/java/am/project/x/utils/StringUtils.java
// @SuppressWarnings("unused")
// public class StringUtils {
// 
//     /**
//      * 字符串匹配
//      *
//      * @param src 源
//      * @param des 匹配样式
//      * @return 是否匹配
//      */
//     public static boolean isMatching(@NonNull String src, @NonNull String des) {
//         String regex = des.replace("*", "\\w*").replace("?", "\\w{1}");
//         return Pattern.compile(regex).matcher(src).matches();
//     }
// 
//     /**
//      * 判断是否是一个IP
//      *
//      * @param IP 字符串
//      * @return 是否是一个IP
//      */
//     public static boolean isIp(@NonNull String IP) {
//         boolean b = false;
//         IP = IP.trim();
//         while (IP.startsWith(" ")) {
//             IP = IP.substring(1).trim();
//         }
//         while (IP.endsWith(" ")) {
//             IP = IP.substring(0, IP.length() - 1).trim();
//         }
//         if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) {
//             String s[] = IP.split("\\.");
//             if (Integer.parseInt(s[0]) < 255)
//                 if (Integer.parseInt(s[1]) < 255)
//                     if (Integer.parseInt(s[2]) < 255)
//                         if (Integer.parseInt(s[3]) < 255)
//                             b = true;
//         }
//         return b;
//     }
// }


// Path: app/src/main/java/am/project/x/business/others/printer/PrinterIPDialog.java
import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import am.project.x.R;
import am.project.x.utils.AlertDialogUtils;
import am.project.x.utils.StringUtils;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDialog;
import com.am.tool.support.utils.InputMethodUtils;

/*
 * Copyright (C) 2018 AlexMofer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package am.project.x.business.others.printer;




/**
 * 固定IP填写对话框
 */
class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener {

    private final OnDialogListener mListener;
    private final EditText mVIp;
    private final EditText mVPort;

    PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
        super(context, AlertDialogUtils.getAlertDialogTheme(context));