package Ġblo der . com . bl itz core . validation Ċ Ċ import Ġandroid . view . View Ċ import Ġandroid . widget . EditText Ċ import Ġblo der . com . bl itz core . Validation Condition Action Ċ Ċ open Ġclass ĠDefault Blit z Valid ations Ġ: ĠB lit z Validation () Ġ{ ĊĊĠĠĠ Ġfun ĠEditText . is Following Regex ( pattern : ĠString ) Ġ: ĠEditText Ġ= Ġbind View Validation ( this ) Ġ{ Ġif Ġ( pattern . isNotEmpty () Ġ&& Ġpattern . isNotBlank ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġit . text . isNotEmpty () Ġ&& Ġit . text . matches ( Regex ( pattern )) ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġit . text . isNotEmpty () Ġ&& Ġit . text . isNotBlank () ĊĠĠĠ Ġ}} ĊĊĠĠĠ Ġfun ĠEditText . is Filled () Ġ: ĠEditText Ġ= Ġbind View Validation ( this ) Ġ{ Ġit . text . isNotEmpty () Ġ} ĊĊĠĠĠ Ġfun ĠEditText . is Email () Ġ: ĠEditText Ġ= Ġbind View Validation ( this ) Ġ{ ĊĠĠĠĠĠĠĠ Ġit . text . isNotEmpty () Ġ&& Ġit . text . matches ( Regex ("^ ([ _ a - zA - Z 0 - 9 - ]+ ( \\. [_ a - zA - Z 0 - 9 - ]+ )* @ [ a - zA - Z 0 - 9 - ]+ (\\ .[ a - zA - Z 0 - 9 - ]+ )*( \\ .[ a - zA - Z ]{ 1 , 6 })) ?$ ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġin fix Ġfun ĠView . on Validation Success ( action : ĠValidation Condition Action ) Ġ: ĠView Ġ= Ġbind Success Condition Action ( this , Ġaction ) ĊĊĠĠĠ Ġin fix Ġfun ĠView . on ValidationError ( action : ĠValidation Condition Action ) Ġ: ĠView Ġ= Ġbind Error Validation Action ( this , Ġaction ) Ċ }