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 rememberMapViewWithLifecycle() { | |
| DisposableEffect(key1 = lifecycle, key2 = mapView) { | |
| // Make MapView follow the current lifecycle | |
| val lifecycleObserver = getMapLifecycleObserver(mapView) | |
| lifecycle.addObserver(lifecycleObserver) | |
| onDispose { | |
| } |
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 DemoCoroutineScope() { | |
| val scope = rememberCoroutineScope() | |
| Button(onClick = { | |
| scope.launch { | |
| //CoroutineScope | |
| //run any suspend functions inside this scope |
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 DemoLaunchedEffect(key1: String, key2: String, key3: String, list: Array<String>) { | |
| LaunchedEffect(key1 = key1) { | |
| //CoroutineScope | |
| } | |
| LaunchedEffect(key1 = key1, key2 = key2) { | |
| //CoroutineScope |
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 TestComposable(modifier: Modifier = Modifier, data: () -> Unit) { | |
| //scope of the composebale | |
| // | |
| } |
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 SecondRootComposable() { | |
| Box(Modifier.fillMaxSize()) { // Recomposition Scope Start | |
| val scroll = rememberScrollState(0) | |
| Title(snack = snack, scrollProvider = {scroll.value }) | |
| } | |
| } |
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 SecondRootComposable() { | |
| Box(Modifier.fillMaxSize()) { // Recomposition Scope Start | |
| val scroll = rememberScrollState(0) | |
| Title(snack = snack,scroll=scroll.value) | |
| } | |
| } |
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
| var name by remember { mutableStateOf("") } |
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 TextFieldDemo() { | |
| Column(Modifier.padding(16.dp)) { | |
| val textState = remember {mutableStateOf(mutableStateOf(""))} | |
| TextField( | |
| value = textState.value, | |
| onValueChange = { textState.value = it } | |
| ) | |
| Text("The textfield has this text:textState.value.text) | |
| } |
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 RootComposable() { | |
| var name by rememberSaveable { mutableStateOf("") } | |
| HelloContent(name = name, onNameChange = { name = it }) | |
| } | |
| @Composable | |
| fun HelloContent(name: String, onNameChange: (String) -> Unit) { | |
| Column(modifier = Modifier.padding(16.dp)) { | |
| Text( |
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.util.Log | |
| import com.currency.domain.CurrencyConverter | |
| import io.ktor.client.* | |
| import io.ktor.client.engine.android.* | |
| import io.ktor.client.plugins.* | |
| import io.ktor.client.plugins.contentnegotiation.* | |
| import io.ktor.client.plugins.logging.* | |
| import io.ktor.client.plugins.observer.* | |
| import io.ktor.serialization.kotlinx.json.* | |
| import kotlinx.serialization.json.Json |