/** Private method invoking fields validation */ private boolean validateFields() { boolean validated = true; if (!mNumberTextField.isValidCardNumber()) { mNumberTextField.setBackgroundResource(R.drawable.textfield_search_empty_pressed); validated = false; } if (!mCVCTextField.isValidCVCNumber(mNumberTextField.getType())) { mCVCTextField.setBackgroundResource(R.drawable.textfield_search_empty_pressed); validated = false; } if (!mExpMonthTextField.isValidMonth()) { mExpMonthTextField.setBackgroundResource(R.drawable.textfield_search_empty_pressed); validated = false; } if (!mExpYearTextField.isValidDate(mExpMonthTextField.getMonth())) { mExpYearTextField.setBackgroundResource(R.drawable.textfield_search_empty_pressed); mExpMonthTextField.setBackgroundResource(R.drawable.textfield_search_empty_pressed); validated = false; } return validated; }
/** Private method used to reset fields */ private void resetErrors() { mNumberTextField.setBackgroundResource(android.R.drawable.edit_text); mCVCTextField.setBackgroundResource(android.R.drawable.edit_text); mExpMonthTextField.setBackgroundResource(android.R.drawable.edit_text); mExpYearTextField.setBackgroundResource(android.R.drawable.edit_text); }