Skip to content

Instantly share code, notes, and snippets.

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
import android.content.Context
import android.os.Build
import android.text.Html
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.SpannedString
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.URLSpan
import android.view.View
@Terenfear
Terenfear / MimicAdjustPanExtensions.kt
Created August 21, 2019 13:35
Helps to mimic the "adjustPan" behaviour for a particular layout when its parent activity has the "adjustResize" behaviour.
import android.animation.ObjectAnimator
import android.app.Activity
import android.view.View
import android.view.ViewGroup
fun ViewGroup.doOnPanRequest(f: (v: View, requestedTranslationY: Float) -> Unit) {
val initTranslationY = translationY
setOnApplyWindowInsetsListener { layout, insets ->
(this.context as? Activity)?.window?.let { w ->
w.currentFocus?.let { focusedView ->