Search in sources :

Example 16 with Validator

use of com.mobsandgeeks.saripaar.Validator in project android-saripaar by ragunathjawahar.

the class OrderedValidateBeforeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_un_ordered_validate_till_before);
    // UI References
    mNameEditText = (EditText) findViewById(R.id.nameEditText);
    mAddressEditText = (EditText) findViewById(R.id.addressEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mPhoneEditText = (EditText) findViewById(R.id.phoneEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    RadioGroup modeRadioGroup = (RadioGroup) findViewById(R.id.modeRadioGroup);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event listeners
    mNameEditText.setOnFocusChangeListener(this);
    mAddressEditText.setOnFocusChangeListener(this);
    mEmailEditText.setOnFocusChangeListener(this);
    mPhoneEditText.setOnFocusChangeListener(this);
    modeRadioGroup.setOnCheckedChangeListener(this);
}
Also used : RadioGroup(android.widget.RadioGroup) Validator(com.mobsandgeeks.saripaar.Validator)

Example 17 with Validator

use of com.mobsandgeeks.saripaar.Validator in project android-saripaar by ragunathjawahar.

the class OrderedValidateTillActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_un_ordered_validate_till_before);
    // UI References
    mNameEditText = (EditText) findViewById(R.id.nameEditText);
    mAddressEditText = (EditText) findViewById(R.id.addressEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mPhoneEditText = (EditText) findViewById(R.id.phoneEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    RadioGroup modeRadioGroup = (RadioGroup) findViewById(R.id.modeRadioGroup);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event listeners
    mNameEditText.setOnFocusChangeListener(this);
    mAddressEditText.setOnFocusChangeListener(this);
    mEmailEditText.setOnFocusChangeListener(this);
    mPhoneEditText.setOnFocusChangeListener(this);
    modeRadioGroup.setOnCheckedChangeListener(this);
}
Also used : RadioGroup(android.widget.RadioGroup) Validator(com.mobsandgeeks.saripaar.Validator)

Example 18 with Validator

use of com.mobsandgeeks.saripaar.Validator in project android-saripaar by ragunathjawahar.

the class QuickRuleOnlyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_rule_only);
    mOneOnlyEditText = (EditText) findViewById(R.id.oneOnlyEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    mSaripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Event listeners
    mSaripaarButton.setOnClickListener(this);
    // Validation
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Add a quick rule
    mValidator.put(mOneOnlyEditText, new QuickRule<TextView>() {

        @Override
        public boolean isValid(TextView textView) {
            return "1".equals(textView.getText().toString());
        }

        @Override
        public String getMessage(Context context) {
            return "Enter 1, nothing else.";
        }
    });
}
Also used : Context(android.content.Context) TextView(android.widget.TextView) Validator(com.mobsandgeeks.saripaar.Validator)

Example 19 with Validator

use of com.mobsandgeeks.saripaar.Validator in project android-saripaar by ragunathjawahar.

the class QuickRuleOrderedActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_rule_ordered);
    // UI References
    mZipCodeEditText = (EditText) findViewById(R.id.zipCodeEditText);
    mAirtelNumberEditText = (EditText) findViewById(R.id.airtelNumberEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    mUseQuickRuleRadioButton = (RadioButton) findViewById(R.id.useQuickRuleRadioButton);
    mSaripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event Listeners
    mUseQuickRuleRadioButton.setOnCheckedChangeListener(this);
    mSaripaarButton.setOnClickListener(this);
}
Also used : Validator(com.mobsandgeeks.saripaar.Validator)

Example 20 with Validator

use of com.mobsandgeeks.saripaar.Validator in project android-saripaar by ragunathjawahar.

the class ConfirmPasswordNoPasswordActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_confirm_password_no_password);
    mConfirmPasswordEditText = (EditText) findViewById(R.id.confirmPasswordEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    mSaripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Event listeners
    mSaripaarButton.setOnClickListener(this);
    // Validation
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
}
Also used : Validator(com.mobsandgeeks.saripaar.Validator)

Aggregations

Validator (com.mobsandgeeks.saripaar.Validator)23 RadioGroup (android.widget.RadioGroup)8 Button (android.widget.Button)7 TextView (android.widget.TextView)6 View (android.view.View)4 CompoundButton (android.widget.CompoundButton)4 Context (android.content.Context)3 RadioButton (android.widget.RadioButton)3 Bundle (android.os.Bundle)1 CheckBox (android.widget.CheckBox)1 EditText (android.widget.EditText)1 QuickRule (com.mobsandgeeks.saripaar.QuickRule)1 HometownZipCode (com.mobsandgeeks.saripaar.tests.ui.validation.HometownZipCode)1