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 androidx.compose.foundation.Image | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.clickable | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.text.BasicText | |
import androidx.compose.runtime.Composable |
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 androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.size | |
import androidx.compose.foundation.text.InlineTextContent | |
import androidx.compose.foundation.text.appendInlineContent | |
import androidx.compose.material.LocalTextStyle | |
import androidx.compose.material.Text | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.draw.drawBehind | |
import androidx.compose.ui.geometry.CornerRadius |
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.graphics.SweepGradient | |
import android.os.Build | |
import androidx.annotation.VisibleForTesting | |
import androidx.compose.runtime.Immutable | |
import androidx.compose.runtime.Stable | |
import androidx.compose.ui.geometry.* | |
import androidx.compose.ui.graphics.* | |
import androidx.compose.ui.util.fastForEachIndexed | |
import androidx.core.graphics.transform |
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.graphics.SweepGradient | |
import android.os.Build | |
import androidx.annotation.VisibleForTesting | |
import androidx.compose.runtime.Immutable | |
import androidx.compose.runtime.Stable | |
import androidx.compose.ui.geometry.* | |
import androidx.compose.ui.graphics.* | |
import androidx.compose.ui.util.fastForEachIndexed | |
import androidx.core.graphics.transform |
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
html { font-family: sans-serif } | |
.top { | |
width: 196px; | |
height: 46px; | |
margin: 2px; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; |
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
/** | |
* This popup uses two hacks: | |
* 1. Deferring the AnimatedVisibility's `visible` state: If `AnimatedVisibility` enters the composition | |
* with `visible = true` by default, it won't animate. So I work around that by setting it to a state defaulting to | |
* `false`, then instantly switch it to `true` during composition by means of a `LaunchedEffect`. | |
* | |
* 2. Deferring the Popup's hiding until the animation is complete: When we set `show = false`, the `Popup` leaves | |
* the composition immediately, so the exit animation isn't shown. To work around this, I set the aforementioned | |
* internal state of the AnimatedVisibility to `false` first (which will start the exit animation), then set | |
* `show = false` once the exit animation is finished by means of a `DisposableEffect`, whose `onDispose` lambda |
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 main() { | |
while (true) { | |
val number = input("Number: ").toIntOrNull() | |
if (number != null) | |
println(number.getName()) | |
else | |
println("Invalid Number!") | |
} | |
} |
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 androidx.compose.desktop.Window | |
import androidx.compose.foundation.clickable | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.foundation.lazy.LazyColumn | |
import androidx.compose.foundation.lazy.items | |
import androidx.compose.material.* | |
import androidx.compose.runtime.* | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.text.TextStyle |