Skip to content

Instantly share code, notes, and snippets.

View mertceyhan's full-sized avatar

Cafer Mert Ceyhan mertceyhan

View GitHub Profile
View ImageCompressor.kt
import org.json.JSONObject
const val tinyPngApiKey = "<YOUR-API-KEY-GOES-HERE>"
val projectDir = File("<PATH-TOPROJECT-ROOT>")
val supportedExtensions = listOf("png", "jpg")
fun main() {
projectDir.walk().forEach { srcFile ->
if (supportedExtensions.contains(srcFile.extension)) {
View HereBeDragons.kt
* Friendly reminder that this might not be the best place to do major changes. Or any changes at all.
* Use the [reason] arg to point your teammates and your future-self to some documentation.
annotation class HereBeDragons(val reason: String)
iammert / BottomBackStackController.kt
Last active June 8, 2022 14:36
Multiple Back Stack Controller + Navigation Component (Instagram-like backstack)
View BottomBackStackController.kt
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import java.util.Stack
import kotlin.collections.HashMap
class BottomBackStackController {
JoseAlcerreca / Event.kt
Created April 26, 2018 10:25
An event wrapper for data that is exposed via a LiveData that represents an event.
View Event.kt
* Used as a wrapper for data that is exposed via a LiveData that represents an event.
open class Event<out T>(private val content: T) {
var hasBeenHandled = false
private set // Allow external read but not write
* Returns the content and prevents its use again.