Skip to content

Instantly share code, notes, and snippets.

View leshchenko's full-sized avatar

Ruslan Leshchenko leshchenko

  • Ukraine, Cherkassy
View GitHub Profile
@tonyawino
tonyawino / MainActivity.kt
Created February 26, 2023 11:59
Popup with Custom Animation in Jetpack Compose
package com.example.popupsample
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.background
@inidamleader
inidamleader / AutoSizeText.kt
Last active June 12, 2024 10:27
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
@pbprateek
pbprateek / ComposeScopedViewModelProvider.kt
Last active October 23, 2023 10:53
Viewmodel Scoped to Compose
import android.os.Bundle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.RememberObserver
import androidx.compose.runtime.remember
import androidx.lifecycle.*
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.MutableCreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import androidx.lifecycle.viewmodel.compose.viewModel