@Test public void checkDestroyingFormAndTheSameField() { ValiFieldBase<String> field = new ValiFieldText(); ValiFiForm form = new ValiFiForm(field); form.destroy(); form.destroy(); field.destroy(); }
public void destroy() { shutdownScheduler(); removeOnPropertyChangedCallback(mCallback); if (mPropertyValidators != null) { mPropertyValidators.clear(); mPropertyValidators = null; } if (mAsyncPropertyValidators != null) { mAsyncPropertyValidators.clear(); mAsyncPropertyValidators = null; } if (mBoundFields != null) { mBoundFields.clear(); mBoundFields = null; } mParentForm = null; mIsChanged = false; mIsError = false; mIsEmptyAllowed = false; }
ValiFieldBase extends BaseObservable implements ValiFiValidable { public void destroy() { shutdownScheduler(); removeOnPropertyChangedCallback(mCallback); if (mPropertyValidators != null) { mPropertyValidators.clear(); mPropertyValidators = null; } if (mAsyncPropertyValidators != null) { mAsyncPropertyValidators.clear(); mAsyncPropertyValidators = null; } if (mBoundFields != null) { mBoundFields.clear(); mBoundFields = null; } mParentForm = null; mIsChanged = false; mIsError = false; mIsEmptyAllowed = false; } }
ValiFieldBase extends BaseObservable implements ValiFiValidable { public void destroy() { shutdownScheduler(); removeOnPropertyChangedCallback(mCallback); if (mPropertyValidators != null) { mPropertyValidators.clear(); mPropertyValidators = null; } if (mAsyncPropertyValidators != null) { mAsyncPropertyValidators.clear(); mAsyncPropertyValidators = null; } if (mBoundFields != null) { mBoundFields.clear(); mBoundFields = null; } mParentForm = null; mIsChanged = false; mIsError = false; mIsEmptyAllowed = false; } ValiFieldBase();  ValiFieldBase(@Nullable ValueType defaultValue);  ValiFieldBase(@Nullable ValueType defaultValue, boolean markAsChanged); }
ValiFieldBase extends BaseObservable implements ValiFiValidable { public void destroy() { shutdownScheduler(); removeOnPropertyChangedCallback(mCallback); if (mPropertyValidators != null) { mPropertyValidators.clear(); mPropertyValidators = null; } if (mAsyncPropertyValidators != null) { mAsyncPropertyValidators.clear(); mAsyncPropertyValidators = null; } if (mBoundFields != null) { mBoundFields.clear(); mBoundFields = null; } mParentForm = null; mIsChanged = false; mIsError = false; mIsEmptyAllowed = false; } ValiFieldBase();  ValiFieldBase(@Nullable ValueType defaultValue);  ValiFieldBase(@Nullable ValueType defaultValue, boolean markAsChanged); @BindingAdapter("error") static void setError(TextInputLayout view, String errorMessage); @BindingAdapter("error") static void setError(EditText view, String errorMessage); static void destroyAll(ValiFiValidable... fields); @Bindable @Override boolean isValid(); void destroy(); @Override void reset(); @Override void validate(); ValiFieldBase<ValueType> setEmptyAllowed(boolean isEmptyAllowed); ValiFieldBase<ValueType> setErrorDelay(long delayMillis); ValiFieldBase<ValueType> setErrorDelay(ValiFiErrorDelay delayType); ValiFieldBase<ValueType> setAsyncValidationDelay(long millis); @Nullable ValueType get(); void set(@Nullable ValueType value); @Nullable @Bindable String getValue(); void setValue(@Nullable String value); @Bindable boolean isInProgress(); @Override void setFormValidation(@Nullable ValiFiForm form); @Nullable ValiFiForm getBoundForm(); @Nullable @Bindable String getError(); void setError(@NonNull String error); ValiFieldBase<ValueType> addVerifyFieldValidator(@StringRes int errorResource, final ValiFieldBase<ValueType> targetField); ValiFieldBase<ValueType> addVerifyFieldValidator(String errorMessage, final ValiFieldBase<ValueType> targetField); ValiFieldBase<ValueType> addCustomValidator(PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomValidator(@StringRes int errorResource, PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomValidator(String errorMessage, PropertyValidator<ValueType> validator); boolean removeValidator(@NonNull PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(AsyncPropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(@StringRes int errorResource, AsyncPropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(String errorMessage, AsyncPropertyValidator<ValueType> validator); boolean removeAsyncValidator(@NonNull AsyncPropertyValidator<ValueType> validator); @Override void refreshError(); }
ValiFieldBase extends BaseObservable implements ValiFiValidable { public void destroy() { shutdownScheduler(); removeOnPropertyChangedCallback(mCallback); if (mPropertyValidators != null) { mPropertyValidators.clear(); mPropertyValidators = null; } if (mAsyncPropertyValidators != null) { mAsyncPropertyValidators.clear(); mAsyncPropertyValidators = null; } if (mBoundFields != null) { mBoundFields.clear(); mBoundFields = null; } mParentForm = null; mIsChanged = false; mIsError = false; mIsEmptyAllowed = false; } ValiFieldBase();  ValiFieldBase(@Nullable ValueType defaultValue);  ValiFieldBase(@Nullable ValueType defaultValue, boolean markAsChanged); @BindingAdapter("error") static void setError(TextInputLayout view, String errorMessage); @BindingAdapter("error") static void setError(EditText view, String errorMessage); static void destroyAll(ValiFiValidable... fields); @Bindable @Override boolean isValid(); void destroy(); @Override void reset(); @Override void validate(); ValiFieldBase<ValueType> setEmptyAllowed(boolean isEmptyAllowed); ValiFieldBase<ValueType> setErrorDelay(long delayMillis); ValiFieldBase<ValueType> setErrorDelay(ValiFiErrorDelay delayType); ValiFieldBase<ValueType> setAsyncValidationDelay(long millis); @Nullable ValueType get(); void set(@Nullable ValueType value); @Nullable @Bindable String getValue(); void setValue(@Nullable String value); @Bindable boolean isInProgress(); @Override void setFormValidation(@Nullable ValiFiForm form); @Nullable ValiFiForm getBoundForm(); @Nullable @Bindable String getError(); void setError(@NonNull String error); ValiFieldBase<ValueType> addVerifyFieldValidator(@StringRes int errorResource, final ValiFieldBase<ValueType> targetField); ValiFieldBase<ValueType> addVerifyFieldValidator(String errorMessage, final ValiFieldBase<ValueType> targetField); ValiFieldBase<ValueType> addCustomValidator(PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomValidator(@StringRes int errorResource, PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomValidator(String errorMessage, PropertyValidator<ValueType> validator); boolean removeValidator(@NonNull PropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(AsyncPropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(@StringRes int errorResource, AsyncPropertyValidator<ValueType> validator); ValiFieldBase<ValueType> addCustomAsyncValidator(String errorMessage, AsyncPropertyValidator<ValueType> validator); boolean removeAsyncValidator(@NonNull AsyncPropertyValidator<ValueType> validator); @Override void refreshError();  }