Skip to content

Instantly share code, notes, and snippets.

View ThePromoter's full-sized avatar

Dan Pinciotti ThePromoter

  • Pacaso
  • Columbus, OH
View GitHub Profile
@ThePromoter
ThePromoter / CoilPreloaderModelProvider.kt
Last active February 23, 2023 22:58
Prefetching lazy list items with coil
interface CoilPreloaderModelProvider<U> {
fun getPreloadItems(position: Int): List<U>
fun getPreloadRequest(item: U): ImageRequest?
}
@ThePromoter
ThePromoter / ContentResolverUriUtils.kt
Created October 7, 2019 18:31
A series of kotlin classes to allow uploading files to a server using OkHttp via android Uris. Supports using streams so as to avoid memory issues, and a progress update listener to get a handle into the progress of the upload.
package com.dpinciotti.utils
import android.content.ContentResolver
import android.net.Uri
import android.provider.OpenableColumns
import timber.log.Timber
import java.io.InputStream
import javax.inject.Inject
/**