Skip to content

Instantly share code, notes, and snippets.

View FireZenk's full-sized avatar
🌍
Improving the world

Jorge Garrido FireZenk

🌍
Improving the world
View GitHub Profile
@FireZenk
FireZenk / gzip.kts
Last active November 22, 2018 15:09 — forked from sgdan/gzip.kts
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun String.gzip(): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(this) }
return bos.toByteArray()

Trying to find a solution

I had a problem getting the new fancy SwipeRefreshLayout from the appcompat lib to work with a custom listview, in this case the StickyListHeaders. Since the First child of the SwipeRefreshLayout should be either a ScrollView or a pure List, some workaround had to be done.