Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Segun is typing...

Segun Famisa segunfamisa

💻
Segun is typing...
View GitHub Profile
@segunfamisa
segunfamisa / AdapterObservableListItem.kt
Created September 26, 2019 09:11
Delegated Properties for RecyclerView Adapters
View AdapterObservableListItem.kt
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
View SearchResponse.kt
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
View User.java
import com.google.gson.annotations.SerializedName;
public class User {
@SerializedName("login")
private String login;
@SerializedName("id")
private long id;
View Calculator.java
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
View app-module-build.gradle
// 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