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 | |
| fun BackgroundItemsMovement() { | |
| var backgroundItemsMovementState by remember { mutableStateOf(PositionState.Start) } | |
| Box(modifier = Modifier.fillMaxSize()) { | |
| Row(modifier = Modifier.fillMaxSize()) { | |
| repeat(4) { | |
| BuildImg( | |
| multiply = Random.nextInt(500, 4500), | |
| state = backgroundItemsMovementState |
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 | |
| fun BikeScreen() { | |
| var bikeState by remember { mutableStateOf(BikePosition.Start) } | |
| // val offsetAnimation: Dp by animateDpAsState( | |
| // //get display size | |
| // if (bikeState == BikePosition.Start) (800).dp else (-100).dp, | |
| // ) | |
| val offsetX by animateDpAsState(targetValue = if (bikeState == BikePosition.Start) 5.dp else 300.dp, animationSpec = |
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
| val updateMapMarker: (LatLng) -> Unit = { latLng -> } |
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
| //There are 4 simple steps to follow while replacing the depricated method startActivityForResult(...). | |
| private val activityResult = this.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> | |
| when(result.resultCode){ | |
| 123 ->{} | |
| 6353 ->{} | |
| } | |
| } | |
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
| getStreetAddressByLatLngUseCase.invoke(latLng.latitude, latLng.longitude).fold( | |
| ifLeft = { | |
| }, ifRight = { | |
| searchAddress(it) | |
| }) |
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
| fun String.removeWhitespace(): String = filterNot { it.isWhitespace() } |
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
| private suspend fun getToken(foo: String): String? = suspendCoroutine { continuation -> | |
| val fooToken = tokenApiExample.Token(foo).start | |
| fooToken.onCreateTokenListener { data -> | |
| when { | |
| data.has("id") -> { | |
| val token = data.getString("id") | |
| continuation.resume(token) | |
| } | |
| else -> { | |
| continuation.resume(null) |
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
| data class Result( | |
| val requestCode: Int, | |
| val data: Intent?, | |
| ) | |
| val Result.isOk: Boolean | |
| get() = resultCode == Activity.RESULT_OK |
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
| fun RecyclerView.onEndScrollListener(listener:()->Unit){ | |
| this.addOnScrollListener(object : RecyclerView.OnScrollListener() { | |
| override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { | |
| super.onScrollStateChanged(recyclerView, newState) | |
| if (!recyclerView.canScrollVertically(1) && newState == RecyclerView.SCROLL_STATE_IDLE) { | |
| listener() | |
| } | |
| } | |
| }) | |
| } |
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
| { | |
| "uid": "1252MM", | |
| "userType": "married" | |
| } |