Skip to content

Instantly share code, notes, and snippets.

View be1ski's full-sized avatar

Dmitriy Belskiy be1ski

  • Tbilisi, Georgia
View GitHub Profile
@owlscatcher
owlscatcher / wireguard.md
Last active May 25, 2024 11:25
Инструкция по нрастройке своего VPN сервера на облаке DigitalOcean
@sockeqwe
sockeqwe / AdapterDelegateDslExample.kt
Created July 22, 2019 08:19
AdapterDelegates Kotlin DSL
/**
* Let's say we want to display a list of Animals in a RecyclerView.
* The list can contain items of type Dog, Cat and Snake.
*/
// AdapterDelegate for Dog.
fun dogAdapterDelegate(picasso : Picasso) = adapterDelegate<Dog, Animal>(R.layout.item_dog){ // Generics Types means this AdapterDelegate is used if item is instanceof Dog (whole list is List<Anmial>)
// this block is run once in onCreateViewHolder. Think of it as an intializer for a ViewHolder.
val name = findViewById(R.id.name)
val image = findViewById(R.id.image)