/** * 检查参数, * * @param editInput 文本输入 * @param listener 监听 * @param hint 提示 * @return */ private boolean isParamsNull( String editInput, ActionCallbackListener<Void> listener, String hint) { if (TextUtils.isEmpty(editInput)) { if (listener != null) { listener.onFailure(ErrorEvent.PARAM_NULL, hint); } return true; } return false; }
private boolean isPhonePatternWrong(String phoneNum, ActionCallbackListener<Void> listener) { Pattern pattern = Pattern.compile("1\\d{10}"); Matcher matcher = pattern.matcher(phoneNum); if (!matcher.matches()) { if (listener != null) { listener.onFailure( ErrorEvent.PARAM_ILLEGAL, context.getString(R.string.api_hint_phone_is_wrong_pattern)); } return true; } return false; }