// Path: GGAForms/ggaforms/src/main/java/com/greengrowapps/ggaforms/validation/errors/ValidationError.java
// public interface ValidationError {
//     CharSequence getLocalizedMessage();
// }
// 
// Path: GGAForms/ggaformsui/src/main/java/com/greengrowapps/ggaformsui/edittext/AbstractEditTextField.java
// public abstract class AbstractEditTextField<T> extends AbstractUiField<T> implements TextWatcher {
// 
//     private boolean firstEdit = true;
//     private EditText editText;
// 
//     public AbstractEditTextField(Class<T> clazz, EditText editText) {
//         super(clazz);
//         editText.addTextChangedListener(this);
//         editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
//             @Override
//             public void onFocusChange(View view, boolean gainFocus) {
//                 if (!gainFocus) {
//                     onFocusLost();
//                 }
//             }
//         });
//         this.editText = editText;
//     }
// 
//     protected void onFocusLost(){
//         firstEdit = false;
//         displayError();
//     }
// 
//     protected abstract T textToObj(String text);
//     protected abstract CharSequence objToText(T value);
// 
//     @Override
//     public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//         //Not used
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//         setValue(textToObj(charSequence.toString()));
//     }
// 
//     @Override
//     public void afterTextChanged(Editable editable) {
//         //not used
//     }
// 
//     protected boolean isFirstEdit() {
//         return firstEdit;
//     }
// 
// 
//     @Override
//     protected void displayError() {
//         if(!isFirstEdit()){
//             super.displayError();
//         }
//     }
// 
//     @Override
//     public void setValue(T value) {
//         super.setValue(value);
//         if(!isEqual(value, textToObj(editText.getText().toString()))) {
//             int cursorEnd = editText.getSelectionEnd();
//             int cursorStart = editText.getSelectionStart();
//             editText.setText(objToText(value));
//             editText.setSelection(cursorStart, cursorEnd);
//         }
// 
//     }
// }


import android.support.design.widget.TextInputLayout;
import android.text.TextWatcher;
import com.greengrowapps.ggaforms.validation.errors.ValidationError;
import com.greengrowapps.ggaformsui.edittext.AbstractEditTextField;
package com.greengrowapps.ggaformsui.textinputlayout;



public abstract class AsbstractInputLayoutField<T> extends AbstractEditTextField<T> implements TextWatcher {

    private final TextInputLayout textInputLayout;

    public AsbstractInputLayoutField(Class<T> clazz, TextInputLayout textInputLayout) {
        super(clazz, textInputLayout.getEditText());
        this.textInputLayout = textInputLayout;
    }

// Path: GGAForms/ggaforms/src/main/java/com/greengrowapps/ggaforms/validation/errors/ValidationError.java
// public interface ValidationError {
//     CharSequence getLocalizedMessage();
// }
// 
// Path: GGAForms/ggaformsui/src/main/java/com/greengrowapps/ggaformsui/edittext/AbstractEditTextField.java
// public abstract class AbstractEditTextField<T> extends AbstractUiField<T> implements TextWatcher {
// 
//     private boolean firstEdit = true;
//     private EditText editText;
// 
//     public AbstractEditTextField(Class<T> clazz, EditText editText) {
//         super(clazz);
//         editText.addTextChangedListener(this);
//         editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
//             @Override
//             public void onFocusChange(View view, boolean gainFocus) {
//                 if (!gainFocus) {
//                     onFocusLost();
//                 }
//             }
//         });
//         this.editText = editText;
//     }
// 
//     protected void onFocusLost(){
//         firstEdit = false;
//         displayError();
//     }
// 
//     protected abstract T textToObj(String text);
//     protected abstract CharSequence objToText(T value);
// 
//     @Override
//     public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//         //Not used
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//         setValue(textToObj(charSequence.toString()));
//     }
// 
//     @Override
//     public void afterTextChanged(Editable editable) {
//         //not used
//     }
// 
//     protected boolean isFirstEdit() {
//         return firstEdit;
//     }
// 
// 
//     @Override
//     protected void displayError() {
//         if(!isFirstEdit()){
//             super.displayError();
//         }
//     }
// 
//     @Override
//     public void setValue(T value) {
//         super.setValue(value);
//         if(!isEqual(value, textToObj(editText.getText().toString()))) {
//             int cursorEnd = editText.getSelectionEnd();
//             int cursorStart = editText.getSelectionStart();
//             editText.setText(objToText(value));
//             editText.setSelection(cursorStart, cursorEnd);
//         }
// 
//     }
// }


// Path: GGAForms/ggaformsui/src/main/java/com/greengrowapps/ggaformsui/textinputlayout/AsbstractInputLayoutField.java
import android.support.design.widget.TextInputLayout;
import android.text.TextWatcher;
import com.greengrowapps.ggaforms.validation.errors.ValidationError;
import com.greengrowapps.ggaformsui.edittext.AbstractEditTextField;

package com.greengrowapps.ggaformsui.textinputlayout;



public abstract class AsbstractInputLayoutField<T> extends AbstractEditTextField<T> implements TextWatcher {

    private final TextInputLayout textInputLayout;

    public AsbstractInputLayoutField(Class<T> clazz, TextInputLayout textInputLayout) {
        super(clazz, textInputLayout.getEditText());
        this.textInputLayout = textInputLayout;
    }

    @Override