private val cb_terms_and_condition: AppCompatCheckBox = findViewById(R.id.cb_terms_and_condition)private val et_confirm_password: TextView = findViewById(R.id.et_confirm_password)private val et_password: TextView = findViewById(R.id.et_password)private val et_email: TextView = findViewById(R.id.et_email)private val et_last_name: TextView = findViewById(R.id.et_last_name)private val et_first_name: TextView = findViewById(R.id.et_first_name)private fun validateRegisterDetails(): Boolean {return when {TextUtils.isEmpty(et_first_name.text.toString().trim { it <= '' }) -> {showErrorSnackBar(resources.getString(R.string.err_msg_enter_first_name), true)false}
TextUtils.isEmpty(et_last_name.text.toString().trim { it <= '' }) -> { showErrorSnackBar(resources.getString(R.string.err_msg_enter_last_name), true) false } TextUtils.isEmpty(et_email.text.toString().trim { it <= '' }) -> { showErrorSnackBar(resources.getString(R.string.err_msg_enter_email), true) false } TextUtils.isEmpty(et_password.text.toString().trim { it <= '' }) -> { showErrorSnackBar(resources.getString(R.string.err_msg_enter_password), true) false } TextUtils.isEmpty(et_confirm_password.text.toString().trim { it <= '' }) -> { showErrorSnackBar(resources.getString(R.string.err_msg_enter_confirm_password), true) false } et_password.text.toString().trim { it <= '' } !=et_confirm_password.text.toString() .trim { it <= '' } -> { showErrorSnackBar(resources.getString(R.string.err_msg_password_and_confirm_password_mismatch), true) false } !cb_terms_and_condition.isChecked -> { showErrorSnackBar(resources.getString(R.string.err_msg_agree_terms_and_condition), true) false } else -> { showErrorSnackBar(resources.getString(R.string.registery_successfull), false) true } }}