Skip to content

Instantly share code, notes, and snippets.

@umarov
Created January 25, 2018 23:19
Show Gist options
  • Save umarov/c95cf3a50080bd7484f0c93d48723e83 to your computer and use it in GitHub Desktop.
Save umarov/c95cf3a50080bd7484f0c93d48723e83 to your computer and use it in GitHub Desktop.
TodoListDetailAdapter
class TodoListDetailAdapter(
val context: Context,
inline val onTodoItemAction: (todoItem: TodoItem, actionType: Int) -> Unit) {
fun createTodoItem(todoItem: TodoItem) {
onTodoItemAction(todoItem, TodoItem.CREATE)
}
fun updateTodoItem(todoItem: TodoItem) {
onTodoItemAction(todoItem, TodoItem.UPDATE)
}
fun deleteTodoItem(todoItem: TodoItem) {
onTodoItemAction(todoItem, TodoItem.DELETE)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment