Available Features

Common Functions

  • Context.showToastMessage(message: String)

  • Context.showSnackBar(message: String)

  • Any.showLogMessage(tag: String?, type: String)

  • Context.showAlertDialog(title: String, message: String, positiveButton: String)

  • getFormattedDate(fromFormat: String, toFormat: String)

  • getConvertedDate(time: String, dayOfDate: Int)

  • LongDate?.getDateFromMilli(format: String)

  • Date?.getFormattedDate(format: String)

  • ImageView.setTint(@ColorInt colorRes: Int)

  • CheckBox.setColorState(@ColorInt colorRes: Int)

  • View.changeBackgroundColor(@ColorInt colorRes: Int)

  • TextView.strikeTextView()

  • TextView.setMarque()

  • EditText.moveCursorAtEnd()

  • getFilter() -- use this method like this (EditText.filters = getFilter())

  • Context.playAnim(view: View, @AnimRes anim: Int)

  • Activity.hideSoftKeyboard()

  • Context.showKeyBoard(view: View)

  • String.isEmailValid(): Boolean

  • String.isValid(regex: String): Boolean -- can use this funtion to check (i.e password,mobile etc.)


Validator

val validator = Validation.create(context.get()).apply {

isEmpty(yourStringValue,YourStringErrorMessage)

areEqual(yourStringValue1, yourStringValue2 ,YourStringErrorMessage)

areNotEqual(yourStringValue1, yourStringValue2 ,YourStringErrorMessage)

}

if (validator.isValid()) {

doStuff()

}