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 FixedLazyGrid() { | |
val colors = remember { | |
listOf(Color.Yellow, Color.LightGray, Color.Cyan) | |
} | |
LazyVerticalGrid( | |
columns = GridCells.Fixed(5), | |
content = { | |
for (i in 0..20) { | |
item { |
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 FlowRowSample() { | |
val colors = remember { | |
listOf(Color.Yellow, Color.LightGray, Color.Cyan) | |
} | |
Box(modifier = Modifier.padding(4.dp)) { | |
FlowRow { | |
for (i in 0..10) { | |
Box( | |
modifier = Modifier |
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
// gradle dependecies (app.gradle) | |
dependencies { | |
implementation "androidx.compose.material3:material3:<latest_version>" | |
implementation "androidx.compose.material3:material3-window-size-class:<latest_version>" | |
} | |
// Activity | |
class MainActivity : ComponentActivity() { |
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 Timer() { | |
val timerDuration = 5000L | |
println("Composing Timer") | |
LaunchedEffect(key1 = Unit, block = { | |
startTimer(timerDuration) { | |
println("Timer ended") | |
} | |
}) | |
} |
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 TimerScreen() { | |
val scope = rememberCoroutineScope() | |
Column { | |
Button(onClick = { | |
println("Timer started") | |
scope.launch { | |
try { | |
startTimer(5000) { | |
println("Timer ended") |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="240dp" | |
android:padding="8dp"> | |
<android.support.constraint.Guideline |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:showIn="@layout/activity_main"> | |
<android.support.constraint.Guideline |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="200dp" | |
tools:context=".MainActivity"> | |
<android.support.constraint.Guideline | |
android:id="@+id/titleTextViewGuideline" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:padding="16dp" | |
tools:context=".MainActivity"> | |
<TextView |