package com.android.zpl;

import android.content.Context;
import android.widget.EditText;
import android.widget.Toast;

/**
 * Created by NO on 2018/12/13.
 */

public class UtilityTooth {
    public static int chackEdtextArea(Context context, EditText editText, int lessNumber, int moreNumber, String str){
        String edstr = editText.getText().toString().trim();
        if (edstr.length()>4){
            ToastMessage(context, str);
            return -1;
        }
        int valueOf = Integer.valueOf(edstr);
        if (valueOf<lessNumber||valueOf>moreNumber) {
            ToastMessage(context, str);
            return -1;
        }else {
            return valueOf;
        }
    }

    private static void ToastMessage(Context context, String str) {
        Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
    }

}
