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
| @Preview(showBackground = true, showSystemUi = true) | |
| @Composable | |
| fun App() { | |
| Column { | |
| MarxistRow { | |
| Text("Left Text", Modifier.background(Color.Red)) | |
| Text("Right Text", Modifier.background(Color.Blue)) | |
| } | |
| MarxistRow { |
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 de.apuri.boing | |
| import android.os.Bundle | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.animation.core.Animatable | |
| import androidx.compose.animation.core.Spring | |
| import androidx.compose.animation.core.spring | |
| import androidx.compose.foundation.BorderStroke | |
| import androidx.compose.foundation.gestures.awaitFirstDown |
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
| # To measure lauch time | |
| fun launchTime(){ | |
| # Config | |
| LAUNCH_COUNT=10 | |
| REGEX='TotalTime: (\d+)' | |
| # The two params are configurable via argument | |
| DEFAULT_PACKAGE_NAME='com.your.packagename' |
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.Animatable | |
| import androidx.compose.animation.core.Spring | |
| import androidx.compose.animation.core.SpringSpec | |
| import androidx.compose.animation.core.spring | |
| import androidx.compose.foundation.Canvas | |
| import androidx.compose.foundation.layout.Box | |
| import androidx.compose.foundation.layout.fillMaxSize | |
| import androidx.compose.foundation.layout.size | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.LaunchedEffect |
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
| /** | |
| * - Requires two frames | |
| * - Need to hide BasicText from view | |
| * - Unnecessary extra composition, way too hacky | |
| * - Can do everything that a BasicText can do | |
| * - Constraints must be applied to BasicText | |
| */ | |
| @Composable | |
| fun UsingBasicText() { | |
| Box(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
| # Hat tip to Kaushik Gopal for some of this | |
| # make zsh tab completion fix capitalization errors for directories and files | |
| # i don't know if this is required anymore | |
| # autoload -Uz compinit && compinit | |
| # 0 -- vanilla completion (abc => abc) | |
| # 1 -- smart case completion (abc => Abc) | |
| # 2 -- word flex completion (abc => A-big-Car) | |
| # 3 -- full flex completion (abc => ABraCadabra) |
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 Screen() { | |
| var date by remember { | |
| mutableStateOf( | |
| TextFieldValue( | |
| text = "dd-MM-yyyy" | |
| ) | |
| ) | |
| } |
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 des.c5inco.cardswipecompose | |
| import androidx.compose.animation.core.Animatable | |
| import androidx.compose.animation.core.CubicBezierEasing | |
| import androidx.compose.animation.core.LinearOutSlowInEasing | |
| import androidx.compose.animation.core.animateDpAsState | |
| import androidx.compose.animation.core.animateFloatAsState | |
| import androidx.compose.animation.core.calculateTargetValue | |
| import androidx.compose.animation.core.keyframes | |
| import androidx.compose.animation.splineBasedDecay |
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
| @Preview | |
| @Composable | |
| private fun DashedDividerPreview() { | |
| DashedDivider( | |
| color = Color.Black, | |
| thickness = 1.dp, | |
| modifier = Modifier | |
| .fillMaxWidth() | |
| .padding(16.dp) | |
| ) |
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 ParallaxScreen(modifier: Modifier = Modifier) { | |
| val context = LocalContext.current | |
| val scope = rememberCoroutineScope() | |
| var data by remember { mutableStateOf<SensorData?>(null) } | |
| DisposableEffect(Unit) { | |
| val dataManager = SensorDataManager(context) | |
| dataManager.init() |