Skip to content

Instantly share code, notes, and snippets.

View inidamleader's full-sized avatar

Inidam Leader inidamleader

View GitHub Profile
@inidamleader
inidamleader / ListPicker.kt
Last active June 1, 2024 11:00
Generic List picker (Number picker, date or any other type) composable function to select an item from a list by scrolling through the list with: possibility of editing and wrapSelectorWheel parameter
package com.inidamleader.ovtracker.util.compose
import androidx.compose.animation.AnimatedContent
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
@inidamleader
inidamleader / AutoSizeText.kt
Last active June 1, 2024 10:51
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
// LAST UPDATE: 01 Jun 2024 V6:
// - Remove ImmutableWrapper due to new possibilities to make List class stable in jetpack compose (compose_compiler_config.conf or enableStrongSkippingMode)
package com.inidamleader.ovtracker.util.compose
import android.util.Log
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.material3.LocalContentColor