Skip to content

Instantly share code, notes, and snippets.

@pawegio
Created March 3, 2018 12:13
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 pawegio/9c3ca36deb9bc7364bc53896e1e7a708 to your computer and use it in GitHub Desktop.
Save pawegio/9c3ca36deb9bc7364bc53896e1e7a708 to your computer and use it in GitHub Desktop.
private fun generateItems(): List<Item> {
val now = LocalDateTime.now()
return List(1_000) { Item(now, it + 1) }
}
private fun bindItem(holder: ViewHolderBinder<Item>, item: Item) = with(holder.itemView) {
val date = item.now.plusDays(item.offset.toLong()).toLocalDate().atStartOfDay()
val remainingTime = getRemainingTime(item.now, date)
dateView.text = date.format(DateTimeFormatter.ISO_LOCAL_DATE)
remainingTimeView.text = resources.getString(R.string.remaining, remainingTime)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment