Skip to content

Instantly share code, notes, and snippets.

View segunfamisa's full-sized avatar
💻
Segun is typing...

Segun Famisa segunfamisa

💻
Segun is typing...
View GitHub Profile
@Test
fun `$description$`() {
$END$
}
@segunfamisa
segunfamisa / AdapterObservableListItem.kt
Created September 26, 2019 09:11
Delegated Properties for RecyclerView Adapters
class ObservableListField<T, VH : RecyclerView.ViewHolder>(
private val adapter: RecyclerView.Adapter<VH>,
private val diffUtilCallbackProducer: ((List<T>, List<T>) -> DiffUtil.Callback)?,
initialValue: List<T>
) : ObservableProperty<List<T>>(initialValue = initialValue) {
private var result: DiffUtil.DiffResult? = null
override fun beforeChange(
property: KProperty<*>,
@segunfamisa
segunfamisa / SearchResponse.kt
Last active May 21, 2017 19:20
Response class for Github Search API response
data class User(
val login: String,
val id: Long,
val url: String,
val html_url: String,
val followers_url: String,
val following_url: String,
val starred_url: String,
val gists_url: String,
val type: String,
@segunfamisa
segunfamisa / User.java
Created May 21, 2017 18:39
User data class from the Github Search API
import com.google.gson.annotations.SerializedName;
public class User {
@SerializedName("login")
private String login;
@SerializedName("id")
private long id;
public class Calculator {
private int a;
private int b;
public Calculator(int a, int b) {
this.a = a;
this.b = b;
}
public void sum() {
@segunfamisa
segunfamisa / app-module-build.gradle
Last active June 22, 2020 11:43
Using gradle extra properties to manage Android dependency versioning
// app module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.segunfamisa.gradleextraproperties"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion