├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rodrigodominguez │ │ └── mixanimationsjetpackcompose │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── rodrigodominguez │ │ │ └── mixanimationsjetpackcompose │ │ │ ├── MainActivity.kt │ │ │ ├── starbucksdemo │ │ │ ├── CardComposable.kt │ │ │ └── StarbucksDemo.kt │ │ │ └── ui │ │ │ └── Color.kt │ └── res │ │ ├── drawable-v24 │ │ ├── chip.webp │ │ ├── contactless_24px_black.xml │ │ ├── ic_launcher_foreground.xml │ │ ├── ic_visa_inc_logo_black.xml │ │ └── mocha.jpg │ │ ├── drawable │ │ ├── coffee_takeaway_outline.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── rodrigodominguez │ └── mixanimationsjetpackcompose │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MixAnimationsJetpackCompose 2 | 3 | ### This repository contains a set of MotionLayout/ConstraintLayout Compose examples. 4 | 5 | ----------------------------- 6 | ## ConstraintLayout Compose Samples 7 | 8 | | Title | GIF | Composable | 9 | | :----: | :----: | :----: | 10 | | Starbucks Demo (inProgress) | | [Composable](https://github.com/rodrigomartind/MixAnimationsJetpackCompose/blob/main/app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/starbucksdemo/CardComposable.kt) 11 | 12 | 13 | ## MotionLayout Compose Samples 14 | 15 | | Title | GIF | Composable | 16 | | :----: | :----: | :----: | 17 | | Starbucks Demo (**inProgress**) | | [Composable](https://github.com/rodrigomartind/MixAnimationsJetpackCompose/blob/main/app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/starbucksdemo/StarbucksDemo.kt) 18 | 19 | 20 | ## Find me at: 21 | [![Medium](https://img.shields.io/badge/Medium-@rodrigomartind-9146FF?style=for-the-badge&logo=medium&logoColor=white&labelColor=101010)](https://rodrigomartind.medium.com/) 22 |
23 | [![Twitter](https://img.shields.io/badge/Twitter-@rodrigomartind-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white&labelColor=101010)](https://twitter.com/RodrigoMartinD) 24 |
25 | [![LinkedIn](https://img.shields.io/badge/LinkedIn-Rodrigo_Dominguez-0077B5?style=for-the-badge&logo=linkedin&logoColor=white&labelColor=101010)](https://www.linkedin.com/in/rodrigo-martin-dominguez-463b5a33/) 26 |
27 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | 9 | defaultConfig { 10 | applicationId "com.rodrigodominguez.mixanimationsjetpackcompose" 11 | minSdkVersion 24 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | buildFeatures { 19 | compose true 20 | } 21 | composeOptions { 22 | kotlinCompilerVersion "1.5.10" 23 | kotlinCompilerExtensionVersion '1.0.0-rc02' 24 | } 25 | 26 | buildTypes { 27 | release { 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 30 | } 31 | } 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | } 40 | 41 | dependencies { 42 | 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 44 | implementation 'androidx.core:core-ktx:1.3.2' 45 | implementation 'androidx.appcompat:appcompat:1.2.0' 46 | implementation 'com.google.android.material:material:1.3.0' 47 | 48 | testImplementation 'junit:junit:4.+' 49 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 50 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 51 | 52 | implementation "androidx.constraintlayout:constraintlayout-compose:$constraint_version" 53 | 54 | implementation "androidx.compose.ui:ui:$compose_version" 55 | // Tooling support (Previews, etc.) 56 | implementation "androidx.compose.ui:ui-tooling:$compose_version" 57 | // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.) 58 | implementation "androidx.compose.foundation:foundation:$compose_version" 59 | // Material Design 60 | implementation "androidx.compose.material:material:$compose_version" 61 | // Material design icons 62 | implementation "androidx.compose.material:material-icons-core:$compose_version" 63 | implementation "androidx.compose.material:material-icons-extended:$compose_version" 64 | // Integration with activities 65 | implementation "androidx.activity:activity-compose:$compose_version" 66 | // Integration with observables 67 | implementation "androidx.compose.runtime:runtime-livedata:$compose_version" 68 | implementation "androidx.compose.runtime:runtime-rxjava2:$compose_version" 69 | 70 | // UI Tests 71 | androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" 72 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/rodrigodominguez/mixanimationsjetpackcompose/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.rodrigodominguez.mixanimationsjetpackcompose", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose 2 | 3 | import android.os.Bundle 4 | import androidx.activity.compose.setContent 5 | import androidx.appcompat.app.AppCompatActivity 6 | import androidx.compose.animation.ExperimentalAnimationApi 7 | import androidx.compose.material.ExperimentalMaterialApi 8 | import androidx.compose.material.MaterialTheme 9 | import androidx.compose.material.Surface 10 | import androidx.compose.runtime.Composable 11 | import androidx.compose.ui.tooling.preview.Preview 12 | import com.rodrigodominguez.mixanimationsjetpackcompose.starbucksdemo.CardDemoComposable 13 | import com.rodrigodominguez.mixanimationsjetpackcompose.starbucksdemo.StarbucksDemo 14 | 15 | @ExperimentalMaterialApi 16 | class MainActivity : AppCompatActivity() { 17 | @ExperimentalAnimationApi 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContent { 21 | MaterialTheme { 22 | Surface(color = MaterialTheme.colors.background) { 23 | StarbucksDemo() 24 | //CardDemoComposable() 25 | } 26 | } 27 | } 28 | } 29 | 30 | 31 | @Preview(showBackground = true, name = "Strabucks preview") 32 | @Composable 33 | fun DefaultPreview() { 34 | MaterialTheme { 35 | //StarbucksDemo() 36 | CardDemoComposable() 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/starbucksdemo/CardComposable.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose.starbucksdemo 2 | 3 | import androidx.compose.animation.ExperimentalAnimationApi 4 | import androidx.compose.foundation.Image 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.border 7 | import androidx.compose.foundation.layout.Box 8 | import androidx.compose.foundation.layout.fillMaxSize 9 | import androidx.compose.foundation.layout.height 10 | import androidx.compose.foundation.layout.width 11 | import androidx.compose.foundation.shape.CircleShape 12 | import androidx.compose.foundation.shape.RoundedCornerShape 13 | import androidx.compose.material.ExperimentalMaterialApi 14 | import androidx.compose.material.MaterialTheme 15 | import androidx.compose.material.Text 16 | import androidx.compose.runtime.Composable 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.draw.clip 19 | import androidx.compose.ui.graphics.Brush 20 | import androidx.compose.ui.graphics.Color 21 | import androidx.compose.ui.res.painterResource 22 | import androidx.compose.ui.tooling.preview.Preview 23 | import androidx.compose.ui.unit.dp 24 | import androidx.compose.ui.unit.sp 25 | import androidx.constraintlayout.compose.ConstraintLayout 26 | import com.rodrigodominguez.mixanimationsjetpackcompose.R 27 | import com.rodrigodominguez.mixanimationsjetpackcompose.ui.Color0CardBlur 28 | import com.rodrigodominguez.mixanimationsjetpackcompose.ui.Color1CardBlur 29 | import com.rodrigodominguez.mixanimationsjetpackcompose.ui.Color2CardBlur 30 | 31 | @Composable 32 | fun CardDemoComposable() { 33 | ConstraintLayout( 34 | modifier = Modifier 35 | .fillMaxSize() 36 | .background(color = Color0CardBlur) 37 | ) { 38 | val (cardGlass, shape0, shape1, logo, contactless, chip, number, name, amount) = createRefs() 39 | 40 | val guideline = createGuidelineFromTop(fraction = 0.5f) 41 | 42 | Box(modifier = Modifier 43 | .height(200.dp) 44 | .width(200.dp) 45 | .clip(CircleShape) 46 | .background(Color1CardBlur) 47 | .constrainAs(shape0) { 48 | top.linkTo(cardGlass.top) 49 | start.linkTo(cardGlass.end) 50 | end.linkTo(cardGlass.end) 51 | } 52 | ) 53 | 54 | 55 | Box(modifier = Modifier 56 | .height(200.dp) 57 | .width(200.dp) 58 | .clip(CircleShape) 59 | .background(Color2CardBlur) 60 | .constrainAs(shape1) { 61 | bottom.linkTo(cardGlass.bottom) 62 | start.linkTo(cardGlass.start) 63 | end.linkTo(cardGlass.start) 64 | top.linkTo(cardGlass.bottom) 65 | }) 66 | 67 | Box( 68 | modifier = Modifier 69 | .clip(RoundedCornerShape(40.dp)) 70 | .border(width = 2.dp, color = Color.White, shape = RoundedCornerShape(40.dp)) 71 | .background( 72 | brush = Brush.verticalGradient( 73 | colors = listOf( 74 | Color.White.copy(alpha = 0.4f), 75 | Color.White.copy(alpha = 0.1f) 76 | ) 77 | ) 78 | ) 79 | .height(360.dp) 80 | .width(235.dp) 81 | .constrainAs(cardGlass) { 82 | top.linkTo(parent.top) 83 | start.linkTo(parent.start) 84 | bottom.linkTo(parent.bottom) 85 | end.linkTo(parent.end) 86 | } 87 | ) 88 | 89 | Image( 90 | painter = painterResource(id = R.drawable.chip), 91 | contentDescription = "", 92 | modifier = Modifier 93 | .height(56.dp) 94 | .width(56.dp) 95 | .constrainAs(chip) { 96 | top.linkTo(cardGlass.top, 16.dp) 97 | start.linkTo(cardGlass.start, 16.dp) 98 | } 99 | ) 100 | 101 | Image( 102 | painter = painterResource(id = R.drawable.ic_visa_inc_logo_black), 103 | contentDescription = "", 104 | modifier = Modifier 105 | .height(23.dp) 106 | .width(64.dp) 107 | .constrainAs(logo) { 108 | bottom.linkTo(cardGlass.bottom, 24.dp) 109 | start.linkTo(cardGlass.start, 24.dp) 110 | } 111 | ) 112 | 113 | Image( 114 | painter = painterResource(id = R.drawable.contactless_24px_black), 115 | contentDescription = "", 116 | modifier = Modifier 117 | .height(36.dp) 118 | .width(36.dp) 119 | .constrainAs(contactless) { 120 | bottom.linkTo(cardGlass.bottom, 20.dp) 121 | end.linkTo(cardGlass.end, 20.dp) 122 | } 123 | ) 124 | 125 | Text( 126 | text = "**** 0097", 127 | fontSize = 28.sp, 128 | color = Color.White, 129 | modifier = Modifier.constrainAs(number) { 130 | top.linkTo(cardGlass.top, 20.dp) 131 | end.linkTo(cardGlass.end, 20.dp) 132 | }) 133 | 134 | Text(text = "Rodrigo Dominguez", 135 | fontSize = 18.sp, 136 | color = Color.DarkGray, 137 | modifier = Modifier.constrainAs(name) { 138 | bottom.linkTo(guideline) 139 | start.linkTo(cardGlass.start, 20.dp) 140 | end.linkTo(cardGlass.end, 20.dp) 141 | }) 142 | 143 | Text(text = "USD 25,000", 144 | fontSize = 22.sp, 145 | color = Color.Black, 146 | modifier = Modifier.constrainAs(amount) { 147 | top.linkTo(guideline) 148 | start.linkTo(cardGlass.start, 20.dp) 149 | end.linkTo(cardGlass.end, 20.dp) 150 | }) 151 | } 152 | } 153 | 154 | @ExperimentalMaterialApi 155 | @ExperimentalAnimationApi 156 | @Preview(showBackground = true, name = "Strabucks preview") 157 | @Composable 158 | fun DefaultPreview() { 159 | MaterialTheme { 160 | StarbucksDemo() 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/starbucksdemo/StarbucksDemo.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose.starbucksdemo 2 | 3 | import android.util.MutableBoolean 4 | import androidx.compose.animation.AnimatedVisibility 5 | import androidx.compose.animation.ExperimentalAnimationApi 6 | import androidx.compose.animation.core.Animatable 7 | import androidx.compose.animation.core.animateFloatAsState 8 | import androidx.compose.animation.core.tween 9 | import androidx.compose.foundation.BorderStroke 10 | import androidx.compose.foundation.Image 11 | import androidx.compose.foundation.background 12 | import androidx.compose.foundation.border 13 | import androidx.compose.foundation.gestures.Orientation 14 | import androidx.compose.foundation.layout.* 15 | import androidx.compose.foundation.lazy.LazyRow 16 | import androidx.compose.foundation.lazy.itemsIndexed 17 | import androidx.compose.foundation.shape.CircleShape 18 | import androidx.compose.foundation.shape.RoundedCornerShape 19 | import androidx.compose.material.* 20 | import androidx.compose.runtime.* 21 | import androidx.compose.ui.Alignment 22 | import androidx.compose.ui.Modifier 23 | import androidx.compose.ui.draw.clip 24 | import androidx.compose.ui.graphics.Color 25 | import androidx.compose.ui.layout.layoutId 26 | import androidx.compose.ui.layout.onSizeChanged 27 | import androidx.compose.ui.res.painterResource 28 | import androidx.compose.ui.unit.dp 29 | import androidx.compose.ui.unit.sp 30 | import androidx.constraintlayout.compose.* 31 | import com.rodrigodominguez.mixanimationsjetpackcompose.R 32 | import com.rodrigodominguez.mixanimationsjetpackcompose.ui.StarbucksGreenColor 33 | import java.util.* 34 | 35 | val DIMENSION_16_DP = 16.dp 36 | val DIMENSION_24_DP = 24.dp 37 | val DIMENSION_28_DP = 28.dp 38 | 39 | val FONT_18_SP = 18.sp 40 | val FONT_24_SP = 24.sp 41 | 42 | @ExperimentalAnimationApi 43 | @ExperimentalMaterialApi 44 | @Composable 45 | fun StarbucksDemo() { 46 | var componentHeight by remember { mutableStateOf(1000f) } 47 | val swipeableState = rememberSwipeableState("Bottom") 48 | val anchors = mapOf(0f to "Bottom", componentHeight to "Top") 49 | 50 | var animateToEnd by remember { mutableStateOf(false) } 51 | val progress by animateFloatAsState( 52 | targetValue = if (animateToEnd) 1f else 0f, 53 | animationSpec = tween(1000) 54 | ) 55 | 56 | var cs1 = ConstraintSet( 57 | """ 58 | { 59 | starbucksBody: { 60 | bottom: ['parent','bottom'] 61 | } 62 | } 63 | """ 64 | ) 65 | 66 | var cs2 = ConstraintSet( 67 | """ 68 | { 69 | starbucksBody: { 70 | bottom: ['parent','bottom', 86] 71 | } 72 | } 73 | """ 74 | ) 75 | 76 | var cs3 = ConstraintSet( 77 | """ 78 | { 79 | starbucksBody: { 80 | bottom: ['parent', 'bottom', 486], 81 | } 82 | } 83 | """ 84 | ) 85 | 86 | var start by remember { mutableStateOf(cs1) } 87 | var end by remember { mutableStateOf(cs2) } 88 | var progressSwipe = remember { Animatable(0f) } 89 | 90 | var config by remember { mutableStateOf(0) } 91 | var inTransition by remember { mutableStateOf(false) } 92 | 93 | 94 | var started by remember { mutableStateOf(false) } 95 | if (started) { 96 | LaunchedEffect(config) { 97 | if (!inTransition) { 98 | inTransition = true 99 | progressSwipe.animateTo( 100 | 1f, 101 | animationSpec = tween(2000) 102 | ) 103 | inTransition = false 104 | progressSwipe.snapTo(0f) 105 | when (config) { 106 | 0 -> { 107 | start = cs1 108 | end = cs2 109 | } 110 | 1 -> { 111 | start = cs2 112 | end = cs3 113 | } 114 | } 115 | } else { 116 | inTransition = false 117 | progressSwipe.animateTo( 118 | 0f, 119 | animationSpec = tween(2000) 120 | ) 121 | } 122 | } 123 | } 124 | 125 | //val mprogress = (swipeableState.offset.value / componentHeight) 126 | 127 | 128 | 129 | MotionLayout(start = start, end = end, 130 | progress = progressSwipe.value, 131 | debug = EnumSet.of(MotionLayoutDebugFlags.NONE), 132 | modifier = Modifier 133 | .fillMaxSize() 134 | .background(Color.White) 135 | .swipeable( 136 | state = swipeableState, 137 | anchors = anchors, 138 | // resistance = null, 139 | reverseDirection = true, 140 | thresholds = { _, _ -> FractionalThreshold(0.3f) }, 141 | orientation = Orientation.Vertical 142 | ) 143 | .onSizeChanged { size -> 144 | componentHeight = size.height.toFloat() 145 | } 146 | ) { 147 | val sizeCup = remember { mutableStateOf("L") } 148 | val listCup = remember { 149 | mutableListOf() 150 | } 151 | 152 | StarbucksDetail(listCup) 153 | StarbucksBody(sizeCup, listCup) { 154 | if (!animateToEnd) { 155 | animateToEnd = !animateToEnd 156 | } 157 | started = true; 158 | if (!inTransition) { 159 | config = (config + 1) % 2 160 | } else if (config > 0) { 161 | config = (config - 1) % 2 162 | } 163 | } 164 | } 165 | 166 | } 167 | 168 | @ExperimentalAnimationApi 169 | @Composable 170 | fun StarbucksDetail(listItemsSelected: MutableList) { 171 | ConstraintLayout( 172 | modifier = Modifier 173 | .fillMaxSize() 174 | .layoutId("starbucksDetail") 175 | .background(StarbucksGreenColor) 176 | ) { 177 | val (listBottom) = createRefs() 178 | 179 | LazyRow( 180 | contentPadding = PaddingValues(horizontal = DIMENSION_16_DP), 181 | modifier = Modifier 182 | .constrainAs(listBottom) { 183 | bottom.linkTo(parent.bottom, DIMENSION_16_DP) 184 | } 185 | .fillMaxWidth() 186 | .height(56.dp) 187 | ) { 188 | itemsIndexed(listItemsSelected) { index, item -> 189 | val visibility by remember { mutableStateOf(listItemsSelected.contains(item) && item == listItemsSelected[index]) } 190 | AnimatedVisibility( 191 | visible = visibility 192 | ) { 193 | Box( 194 | modifier = Modifier 195 | .width(56.dp) 196 | .height(56.dp) 197 | .clip( 198 | CircleShape 199 | ) 200 | .background(Color.White) 201 | 202 | ) { 203 | Text(item, modifier = Modifier.align(Alignment.Center)) 204 | } 205 | } 206 | } 207 | } 208 | } 209 | } 210 | 211 | 212 | @Composable 213 | fun StarbucksBody( 214 | sizeCup: MutableState, 215 | listCup: MutableList, 216 | animateToNewItemAdded: () -> Unit 217 | ) { 218 | ConstraintLayout( 219 | modifier = Modifier 220 | .layoutId("starbucksBody") 221 | .background( 222 | Color.White, 223 | shape = RoundedCornerShape( 224 | bottomEnd = DIMENSION_16_DP, 225 | bottomStart = DIMENSION_16_DP 226 | ) 227 | ) 228 | .padding(bottom = 44.dp) 229 | ) { 230 | val (image, title, description, priceBox, addButton) = createRefs() 231 | Image( 232 | painter = painterResource(id = R.drawable.mocha), 233 | contentDescription = "", 234 | modifier = Modifier 235 | .fillMaxWidth() 236 | .height(300.dp) 237 | .constrainAs(image) { 238 | top.linkTo(parent.top) 239 | } 240 | ) 241 | Text( 242 | text = "Mocha Frapuccino", 243 | fontSize = FONT_24_SP, 244 | modifier = Modifier.constrainAs(title) { 245 | top.linkTo(image.bottom, DIMENSION_16_DP) 246 | end.linkTo(parent.end, DIMENSION_16_DP) 247 | start.linkTo(parent.start, DIMENSION_16_DP) 248 | width = Dimension.fillToConstraints 249 | } 250 | ) 251 | Text( 252 | text = "Mocha sauce, Frappuccino roast coffee, milk and ice all come together for a mocha flavor that ll leave you wanting more.", 253 | fontSize = FONT_18_SP, 254 | modifier = Modifier.constrainAs(description) { 255 | top.linkTo(title.bottom, DIMENSION_16_DP) 256 | end.linkTo(parent.end, DIMENSION_16_DP) 257 | start.linkTo(parent.start, DIMENSION_16_DP) 258 | width = Dimension.fillToConstraints 259 | } 260 | ) 261 | SizeCupComponent( 262 | modifier = Modifier 263 | .fillMaxWidth() 264 | .height(96.dp) 265 | .constrainAs(priceBox) { 266 | top.linkTo(description.bottom, DIMENSION_16_DP) 267 | end.linkTo(parent.end, DIMENSION_16_DP) 268 | start.linkTo(parent.start, DIMENSION_16_DP) 269 | width = Dimension.fillToConstraints 270 | }, sizeCup 271 | ) 272 | Button( 273 | onClick = { 274 | animateToNewItemAdded() 275 | listCup.add(sizeCup.value) 276 | }, 277 | modifier = Modifier 278 | .height(56.dp) 279 | .constrainAs(addButton) { 280 | top.linkTo(priceBox.bottom, DIMENSION_16_DP) 281 | end.linkTo(parent.end, DIMENSION_16_DP) 282 | start.linkTo(parent.start, DIMENSION_16_DP) 283 | width = Dimension.fillToConstraints 284 | }, 285 | shape = RoundedCornerShape(DIMENSION_28_DP), 286 | colors = ButtonDefaults.outlinedButtonColors( 287 | backgroundColor = StarbucksGreenColor, 288 | contentColor = Color.White 289 | ) 290 | ) { 291 | Text(text = "Add to bag") 292 | } 293 | } 294 | } 295 | 296 | @Composable 297 | fun SizeCupComponent(modifier: Modifier, size: MutableState) { 298 | ConstraintLayout( 299 | modifier = modifier 300 | ) { 301 | val priceCup = remember { mutableStateOf("3,55") } 302 | 303 | val (price, boxSize) = createRefs() 304 | Text( 305 | text = "$ ${priceCup.value}", 306 | fontSize = 34.sp, 307 | modifier = Modifier.constrainAs(price) { 308 | start.linkTo(parent.start) 309 | top.linkTo(parent.top) 310 | bottom.linkTo(parent.bottom) 311 | }) 312 | Row( 313 | horizontalArrangement = Arrangement.SpaceEvenly, 314 | modifier = Modifier.constrainAs(boxSize) { 315 | start.linkTo(price.end) 316 | end.linkTo(parent.end) 317 | top.linkTo(parent.top) 318 | bottom.linkTo(parent.bottom) 319 | width = Dimension.fillToConstraints 320 | }) { 321 | Button( 322 | onClick = { 323 | priceCup.value = "3,55" 324 | size.value = "L" 325 | }, 326 | border = BorderStroke(2.dp, StarbucksGreenColor), 327 | shape = RoundedCornerShape(8.dp), 328 | modifier = Modifier 329 | .width(65.dp) 330 | .height(65.dp), 331 | colors = ButtonDefaults.outlinedButtonColors(contentColor = StarbucksGreenColor) 332 | ) { 333 | Image( 334 | painter = painterResource(id = R.drawable.coffee_takeaway_outline), 335 | contentDescription = "", 336 | modifier = Modifier 337 | .width(30.dp) 338 | .height(30.dp) 339 | ) 340 | } 341 | Button( 342 | onClick = { 343 | priceCup.value = "3,95" 344 | size.value = "M" 345 | }, 346 | border = BorderStroke(2.dp, StarbucksGreenColor), 347 | shape = RoundedCornerShape(8.dp), 348 | modifier = Modifier 349 | .width(65.dp) 350 | .height(65.dp), 351 | colors = ButtonDefaults.outlinedButtonColors(contentColor = StarbucksGreenColor) 352 | ) { 353 | Image( 354 | painter = painterResource(id = R.drawable.coffee_takeaway_outline), 355 | contentDescription = "", 356 | modifier = Modifier 357 | .width(40.dp) 358 | .height(40.dp) 359 | ) 360 | } 361 | Button( 362 | onClick = { 363 | priceCup.value = "4,20" 364 | size.value = "XL" 365 | }, 366 | border = BorderStroke(2.dp, StarbucksGreenColor), 367 | shape = RoundedCornerShape(8.dp), 368 | modifier = Modifier 369 | .width(65.dp) 370 | .height(65.dp), 371 | colors = ButtonDefaults.outlinedButtonColors(contentColor = StarbucksGreenColor) 372 | ) { 373 | Image( 374 | painter = painterResource(id = R.drawable.coffee_takeaway_outline), 375 | contentDescription = "", 376 | modifier = Modifier 377 | .width(50.dp) 378 | .height(50.dp) 379 | ) 380 | } 381 | 382 | } 383 | 384 | } 385 | } -------------------------------------------------------------------------------- /app/src/main/java/com/rodrigodominguez/mixanimationsjetpackcompose/ui/Color.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose.ui 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val StarbucksGreenColor = Color(0xFF00704A) 6 | val Color0CardBlur = Color(0xFFC19171) 7 | val Color1CardBlur = Color(0xFFE79C7A) 8 | val Color2CardBlur = Color(0xFF973C0E) 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/chip.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/drawable-v24/chip.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/contactless_24px_black.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_visa_inc_logo_black.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/mocha.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/drawable-v24/mocha.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/coffee_takeaway_outline.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #00704A 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MixAnimationsJetpackCompose 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/test/java/com/rodrigodominguez/mixanimationsjetpackcompose/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.rodrigodominguez.mixanimationsjetpackcompose 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.10" 4 | ext.compose_version = "1.1.0-alpha01" 5 | ext.constraint_version = "1.0.0-beta02" 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:7.0.0' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | google() 22 | mavenCentral() 23 | jcenter() // Warning: this repository is going to shut down soon 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigomartind/MixAnimationsJetpackCompose/0037cbe41da161aff1bcff3630911a68fca4df8d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 06 14:25:02 ART 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "MixAnimationsJetpackCompose" 2 | include ':app' 3 | --------------------------------------------------------------------------------