Skip to content

Instantly share code, notes, and snippets.

@tasjapr
tasjapr / pager_example.txt
Last active April 24, 2024 13:40
Accompanist pager with coil preloading and indicator
BoxWithConstraints {
val boxWithConstraintsScope = this
val height = (boxWithConstraintsScope.maxWidth - AppTheme.dimensions.padding_16 * 2) / 16 * 9 // Banner width to height ratio should be 16:9
val context = LocalContext.current
val density = LocalDensity.current
ConstraintLayout {
val (pager, indicator) = createRefs()
@tasjapr
tasjapr / ColoredShadow.kt
Created September 12, 2022 11:02 — forked from cedrickring/ColoredShadow.kt
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.VectorizedAnimationSpec
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.interaction.Interaction
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.material.*