This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.compose.animation.core.AnimationSpec | |
| import androidx.compose.animation.core.animate | |
| import androidx.compose.animation.core.tween | |
| import androidx.compose.foundation.gestures.ScrollableState | |
| import androidx.compose.foundation.layout.Column | |
| import androidx.compose.foundation.layout.ColumnScope | |
| import androidx.compose.foundation.lazy.LazyListState | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.Stable | |
| import androidx.compose.runtime.saveable.Saver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context | |
| import android.graphics.Bitmap | |
| import android.graphics.BitmapFactory | |
| import android.graphics.Matrix | |
| import android.net.Uri | |
| import android.os.Build | |
| import androidx.annotation.Keep | |
| import androidx.exifinterface.media.ExifInterface | |
| import kotlinx.coroutines.Dispatchers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun CardGradient(modifier: Modifier = Modifier) { | |
| Card( | |
| modifier = Modifier.padding(16.dp).fillMaxWidth().aspectRatio(600 / 400f) | |
| .clip(RoundedCornerShape(16.dp)) | |
| ) { | |
| Gradient() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun AutoTextSizeCard() { | |
| var textLength by remember { mutableStateOf(50) } | |
| val baseText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " | |
| val longText = baseText.repeat(textLength / baseText.length + 1).substring(0, textLength) | |
| Card( | |
| modifier = Modifier | |
| .fillMaxWidth() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| enableEdgeToEdge() | |
| setContent { | |
| BorderPathTheme { | |
| Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | |
| Box( | |
| modifier = Modifier | |
| .fillMaxSize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun RulerView( | |
| startValue: Int, | |
| endValue: Int, | |
| step: Int | |
| ) { | |
| val density = LocalDensity.current | |
| val scrollState = rememberScrollState() | |
| val sectionWidth = 80.dp | |
| var sliderValue by remember { mutableFloatStateOf(0.5f) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.chootadev.composetryout | |
| import androidx.annotation.DrawableRes | |
| import androidx.compose.animation.core.animateFloatAsState | |
| import androidx.compose.animation.core.keyframes | |
| import androidx.compose.animation.core.tween | |
| import androidx.compose.foundation.Image | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.border | |
| import androidx.compose.foundation.clickable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| WindowCompat.setDecorFitsSystemWindows(window, false) | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| P2RTheme { | |
| // A surface container using the 'background' color from the theme | |
| Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { | |
| CompositionLocalProvider( | |
| LocalOverscrollConfiguration provides null // Disable overscroll otherwise it consumes the drag before we get the chance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun InteractiveCanvas(maxWidth: Int, maxHeight: Int) { | |
| val random = remember { Random.Default } | |
| var touchPosition by remember { mutableStateOf(Offset.Unspecified) } | |
| val heartSize = 75F | |
| val heartPath = createHeartPath(heartSize) | |
| val heartOffsets = remember { mutableStateListOf<Offset>() } | |
| val heartColors = remember { mutableStateListOf<Color>() } | |
| if (heartOffsets.isEmpty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @OptIn(ExperimentalMaterialApi::class) | |
| @Composable | |
| fun PullToRefreshAnimation() { | |
| val path = remember { | |
| GitHubLogoPath.path.toPath() | |
| } | |
| val lines = remember { | |
| path.asAndroidPath().flatten(error = 0.5f).toList() | |
| } |
NewerOlder