Skip to content

Instantly share code, notes, and snippets.

@kshvkantg
Created December 17, 2022 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kshvkantg/2d2704ae8a422bc65c6c4eabb0419fb4 to your computer and use it in GitHub Desktop.
Save kshvkantg/2d2704ae8a422bc65c6c4eabb0419fb4 to your computer and use it in GitHub Desktop.
class ProductObservable() : BaseObservable(){
constructor(weight : String?) : this() {
this.weight = weight
}
@SerializedName("weight")
@get:Bindable
var weight: String? = null
set(value) {
field = value
weightError = if (field.isNullOrEmpty() || (field
?: "0.00").toDouble() == 0.00
) "Required*" else null
notifyPropertyChanged(BR.weightError)
notifyPropertyChanged(BR.weight)
}
@get:Bindable
var weightError: String? = null
set(value) {
field = value
notifyPropertyChanged(BR.weightError)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment