// Path: core/src/main/java/com/fenlisproject/elf/core/base/BaseApplication.java
// public class BaseApplication extends Application {
// 
//     private AppEnvironment mAppEnvironment;
//     private PreferencesStorage mDefaultPreferencesStorage;
//     private SessionStorage mDefaultSessionStorage;
//     private MemoryStorage<Typeface> fontCache;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         mAppEnvironment = new AppEnvironment(this);
//         mDefaultPreferencesStorage = new PreferencesStorage(this, Configs.DEFAULT_PREFERENCES_NAME);
//         mDefaultSessionStorage = new SessionStorage(this, mAppEnvironment.getSessionDirectory());
//         fontCache = new MemoryStorage<>(Configs.DEFAULT_FONT_CACHE_SIZE);
//     }
// 
//     public AppEnvironment getAppEnvironment() {
//         return mAppEnvironment;
//     }
// 
//     public PreferencesStorage getDefaultPreferencesStorage() {
//         return mDefaultPreferencesStorage;
//     }
// 
//     public SessionStorage getDefaultSessionStorage() {
//         return mDefaultSessionStorage;
//     }
// 
//     public MemoryStorage<Typeface> getFontCache() {
//         return fontCache;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/data/MemoryStorage.java
// public class MemoryStorage<T> implements DataStorage<T> {
// 
//     private final LruCache<String, T> cache;
// 
//     public MemoryStorage(int maxSize) {
//         cache = new LruCache<>(maxSize);
//     }
// 
//     @Override
//     public T get(String key) {
//         return cache.get(key);
//     }
// 
//     @Override
//     public boolean put(String key, T value) {
//         return cache.put(key, value) != null;
//     }
// 
//     @Override
//     public boolean remove(String key) {
//         return cache.remove(key) != null;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/Rule.java
// public abstract class Rule {
// 
//     private String mValidationMessage;
// 
//     public Rule(String mValidationMessage) {
//         this.mValidationMessage = mValidationMessage;
//     }
// 
//     public abstract boolean validate(TextView view);
// 
//     public void apply(TextView view) {
//         if (view.getError() == null) {
//             view.setError(getValidationMessage());
//         } else {
//             String errorValue = view.getError().toString();
//             view.setError(errorValue + "\n" + getValidationMessage());
//         }
//     }
// 
//     public String getValidationMessage() {
//         return mValidationMessage;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Match.java
// public class Match extends Rule {
// 
//     private TextView compared;
// 
//     public Match(String message, TextView compared) {
//         super(message);
//         this.compared = compared;
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.getText().toString().equals(compared.getText().toString());
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/MinimumLength.java
// public class MinimumLength extends Rule {
// 
//     private int minLength;
// 
//     public MinimumLength(String message, int minLength) {
//         super(message);
//         this.minLength = minLength;
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.length() >= minLength;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Required.java
// public class Required extends Rule {
// 
//     public Required(String message) {
//         super(message);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.length() > 0;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Trimmed.java
// public class Trimmed extends Rule {
// 
//     public Trimmed() {
//         super(null);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         view.setText(view.getText().toString().trim());
//         return true;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/ValidEmail.java
// public class ValidEmail extends Rule {
// 
//     public ValidEmail(String message) {
//         super(message);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return Patterns.EMAIL_ADDRESS.matcher(view.getText()).matches();
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
import android.widget.TextView;
import com.fenlisproject.elf.R;
import com.fenlisproject.elf.core.base.BaseApplication;
import com.fenlisproject.elf.core.data.MemoryStorage;
import com.fenlisproject.elf.core.validator.Rule;
import com.fenlisproject.elf.core.validator.rule.Match;
import com.fenlisproject.elf.core.validator.rule.MinimumLength;
import com.fenlisproject.elf.core.validator.rule.Required;
import com.fenlisproject.elf.core.validator.rule.Trimmed;
import com.fenlisproject.elf.core.validator.rule.ValidEmail;
import java.util.ArrayList;
import java.util.List;
        this.mustValidEmail = mustValidEmail;
    }

    public int getMinLength() {
        return mMinLength;
    }

    public void setMinLength(int mMinLength) {
        this.mMinLength = mMinLength;
    }

    public int getMatchValueOf() {
        return mMatchValueOf;
    }

    public void setMatchValueOf(int mMatchValueOf) {
        this.mMatchValueOf = mMatchValueOf;
    }

    public String getValue() {
        return isTrimmed ? getText().toString().trim() : getText().toString();
    }

    public List<Rule> getRules() {
        Context c = getContext();
        List<Rule> rules = new ArrayList<>();
        if (isTrimmed) {
            rules.add(new Trimmed());
        }
        if (isRequired) {
// Path: core/src/main/java/com/fenlisproject/elf/core/base/BaseApplication.java
// public class BaseApplication extends Application {
// 
//     private AppEnvironment mAppEnvironment;
//     private PreferencesStorage mDefaultPreferencesStorage;
//     private SessionStorage mDefaultSessionStorage;
//     private MemoryStorage<Typeface> fontCache;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         mAppEnvironment = new AppEnvironment(this);
//         mDefaultPreferencesStorage = new PreferencesStorage(this, Configs.DEFAULT_PREFERENCES_NAME);
//         mDefaultSessionStorage = new SessionStorage(this, mAppEnvironment.getSessionDirectory());
//         fontCache = new MemoryStorage<>(Configs.DEFAULT_FONT_CACHE_SIZE);
//     }
// 
//     public AppEnvironment getAppEnvironment() {
//         return mAppEnvironment;
//     }
// 
//     public PreferencesStorage getDefaultPreferencesStorage() {
//         return mDefaultPreferencesStorage;
//     }
// 
//     public SessionStorage getDefaultSessionStorage() {
//         return mDefaultSessionStorage;
//     }
// 
//     public MemoryStorage<Typeface> getFontCache() {
//         return fontCache;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/data/MemoryStorage.java
// public class MemoryStorage<T> implements DataStorage<T> {
// 
//     private final LruCache<String, T> cache;
// 
//     public MemoryStorage(int maxSize) {
//         cache = new LruCache<>(maxSize);
//     }
// 
//     @Override
//     public T get(String key) {
//         return cache.get(key);
//     }
// 
//     @Override
//     public boolean put(String key, T value) {
//         return cache.put(key, value) != null;
//     }
// 
//     @Override
//     public boolean remove(String key) {
//         return cache.remove(key) != null;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/Rule.java
// public abstract class Rule {
// 
//     private String mValidationMessage;
// 
//     public Rule(String mValidationMessage) {
//         this.mValidationMessage = mValidationMessage;
//     }
// 
//     public abstract boolean validate(TextView view);
// 
//     public void apply(TextView view) {
//         if (view.getError() == null) {
//             view.setError(getValidationMessage());
//         } else {
//             String errorValue = view.getError().toString();
//             view.setError(errorValue + "\n" + getValidationMessage());
//         }
//     }
// 
//     public String getValidationMessage() {
//         return mValidationMessage;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Match.java
// public class Match extends Rule {
// 
//     private TextView compared;
// 
//     public Match(String message, TextView compared) {
//         super(message);
//         this.compared = compared;
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.getText().toString().equals(compared.getText().toString());
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/MinimumLength.java
// public class MinimumLength extends Rule {
// 
//     private int minLength;
// 
//     public MinimumLength(String message, int minLength) {
//         super(message);
//         this.minLength = minLength;
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.length() >= minLength;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Required.java
// public class Required extends Rule {
// 
//     public Required(String message) {
//         super(message);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return view.length() > 0;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/Trimmed.java
// public class Trimmed extends Rule {
// 
//     public Trimmed() {
//         super(null);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         view.setText(view.getText().toString().trim());
//         return true;
//     }
// }
// 
// Path: core/src/main/java/com/fenlisproject/elf/core/validator/rule/ValidEmail.java
// public class ValidEmail extends Rule {
// 
//     public ValidEmail(String message) {
//         super(message);
//     }
// 
//     @Override
//     public boolean validate(TextView view) {
//         return Patterns.EMAIL_ADDRESS.matcher(view.getText()).matches();
//     }
// }


// Path: core/src/main/java/com/fenlisproject/elf/core/widget/ExtendedTextView.java
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
import android.widget.TextView;
import com.fenlisproject.elf.R;
import com.fenlisproject.elf.core.base.BaseApplication;
import com.fenlisproject.elf.core.data.MemoryStorage;
import com.fenlisproject.elf.core.validator.Rule;
import com.fenlisproject.elf.core.validator.rule.Match;
import com.fenlisproject.elf.core.validator.rule.MinimumLength;
import com.fenlisproject.elf.core.validator.rule.Required;
import com.fenlisproject.elf.core.validator.rule.Trimmed;
import com.fenlisproject.elf.core.validator.rule.ValidEmail;
import java.util.ArrayList;
import java.util.List;

        this.mustValidEmail = mustValidEmail;
    }

    public int getMinLength() {
        return mMinLength;
    }

    public void setMinLength(int mMinLength) {
        this.mMinLength = mMinLength;
    }

    public int getMatchValueOf() {
        return mMatchValueOf;
    }

    public void setMatchValueOf(int mMatchValueOf) {
        this.mMatchValueOf = mMatchValueOf;
    }

    public String getValue() {
        return isTrimmed ? getText().toString().trim() : getText().toString();
    }

    public List<Rule> getRules() {
        Context c = getContext();
        List<Rule> rules = new ArrayList<>();
        if (isTrimmed) {
            rules.add(new Trimmed());
        }
        if (isRequired) {
            rules.add(new Required(c.getString(R.string.required_validation_message)));