Fix DiffUtil usage

This commit is contained in:
Aidan Follestad 2018-12-07 00:38:43 -08:00
parent b09088ab9e
commit b7c51a12ed
2 changed files with 3 additions and 3 deletions

View file

@ -31,10 +31,10 @@ class SiteDiffCallback(
override fun areItemsTheSame(
oldItemPosition: Int,
newItemPosition: Int
) = oldItems[oldItemPosition].id == oldItems[newItemPosition].id
) = oldItems[oldItemPosition].id == newItems[newItemPosition].id
override fun areContentsTheSame(
oldItemPosition: Int,
newItemPosition: Int
) = oldItems[oldItemPosition] == oldItems[newItemPosition]
) = oldItems[oldItemPosition] == newItems[newItemPosition]
}

View file

@ -47,7 +47,7 @@ inline fun <reified T> EditText.attachLiveData(
if (data.value != null) {
this.setText(data.value.toString())
} else {
data.value = this.text.trim().toString().toInt() as T
data.value = (this.text.trim().toString().toIntOrNull() ?: 0) as T
}
}
// Out