This file contains 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
var visible by remember { mutableStateOf(false) } | |
LaunchedEffect(Unit) { | |
delay(300) | |
visible = true | |
} | |
AnimatedVisibility( | |
visible = visible, | |
enter = fadeIn() + slideInVertically { fullHeight -> fullHeight }, |
This file contains 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
private enum class CircleState { | |
MidSize, | |
FullSize | |
} |
This file contains 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
var circleState by remember { mutableStateOf(CircleState.MidSize) } |
This file contains 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
val transition = updateTransition(targetState = circleState, label = "") | |
val circleRadius by transition.animateFloat(label = "", | |
transitionSpec = { | |
if (targetState == CircleState.FullSize) { | |
spring(Spring.DampingRatioHighBouncy, Spring.StiffnessMedium) | |
} else { | |
spring(Spring.DampingRatioNoBouncy, Spring.StiffnessVeryLow) | |
} | |
}) { state -> |
This file contains 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
LaunchedEffect(Unit) { | |
delay(500) | |
circleState = CircleState.FullSize | |
} |
This file contains 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
Canvas(modifier = Modifier.size(cardSize), onDraw = { | |
drawRect( | |
color = backgroundColor, | |
topLeft = Offset(x = size.width - (cardSize.value / 2f) - 7.5f, y = 0f), | |
size = size / 5f | |
) | |
drawCircle( | |
color = bubbleColor, |
This file contains 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
<android.support.constraint.helper.Flow | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:constraint_referenced_ids="ac, plus_minus_switch, percentage, divide, | |
seven, eight, nine, multiply, | |
four, five, six, plus, | |
one, two, three, minus, | |
zero, comma" | |
app:flow_firstHorizontalStyle="spread" | |
app:flow_horizontalStyle="spread" |
This file contains 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() { | |
private val viewModel: MoviesViewModel by viewModel() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
MoviesListTheme { | |
// A surface container using the 'background' color from the theme | |
Surface( | |
modifier = Modifier.fillMaxSize(), |
This file contains 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 MoviesListScreen( | |
onMovieDetails: (Int) -> Unit = {}, | |
movies: State<List<MovieUI>> | |
) { | |
MoviesListUI(movies.value, onMovieDetails) | |
} | |
val mockMovieList = listOf(MovieUI(1, "Batman", "")) |