Skip to content

Instantly share code, notes, and snippets.

@GrJanKandrac
GrJanKandrac / keyboard.kt
Created July 18, 2020 05:00
Your glued-to-bottom-above-ScrollView View will not cover you inputs while opening keyboard
import android.graphics.Rect
import android.view.View
import android.view.ViewTreeObserver
import androidx.annotation.Px
import androidx.core.view.marginBottom
/**
* This View will be marked as static on the screen. Every other view - if focused and placed in
* scrollable view - will be shown above this view while keyboard is being animated
*
@GrJanKandrac
GrJanKandrac / inset.kt
Created November 10, 2020 08:24
Convenient functions to handle Window Insets in Android Applications
package app.common.extensions
import android.content.Context
import android.graphics.Rect
import android.os.Build
import android.view.View
import android.view.ViewGroup
import android.view.WindowInsets
import androidx.annotation.Px
import androidx.core.view.*
package day12.astar
import java.io.FileInputStream
import java.util.*
import kotlin.math.abs
const val startSymbol = 'a' - 1
const val endSymbol = 'z' + 1
const val symbols = "${startSymbol}abcdefghijklmnopqrstuvwxyz${endSymbol}"
var mapWidth = 0
@GrJanKandrac
GrJanKandrac / multianchor_bottomsheet.kt
Created September 14, 2023 09:04
Bottom sheet with multiple anchors and content visible above sheet
package ui.mab
import android.os.Parcelable
import android.util.Log
import androidx.activity.compose.BackHandler
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.*