adte
05/27/2023, 6:49 PMaidanvii
05/29/2023, 9:40 AMJavokhir Savriev
05/29/2023, 10:01 AMfrank
05/31/2023, 11:38 PMvar text by remember { mutableStateOf("") }
MaterialTheme {
Column {
TextField(value = text,
modifier = Modifier.onKeyEvent {
if (it.key == Key.C) {
println("Input Key!")
}
true // return true for stop propagation
},
onValueChange = { text = it },
label = { Text("Search") }, singleLine = true
)
}}
fitken
06/03/2023, 4:10 AMSlackbot
06/03/2023, 4:26 AMadte
06/03/2023, 12:15 PMArjan van Wieringen
06/07/2023, 6:38 AMandroidx.ui.graphics
for thisMo Sobhy
06/07/2023, 7:49 AM// TextField isn't efficient for big text files, we use it for simplicity
So what would be the most efficient component for large text files? 🤔
thank you coloradte
06/07/2023, 9:35 AMRoberto Fernandez Montero
06/07/2023, 11:19 AMArjan van Wieringen
06/07/2023, 11:35 AMverticalAlignment = Alignment.CenterVertically
, but the BasicText
is aligned slightly lower. I'd like them both dead-center:
Column(
modifier = Modifier.background(colors.panelBackground).then(modifier),
verticalArrangement = Arrangement.spacedBy(paddings.small),
) {
items.forEach { item ->
Row(
modifier = Modifier.fillMaxWidth().background(Color.Cyan),
horizontalArrangement = Arrangement.spacedBy(paddings.small),
verticalAlignment = Alignment.CenterVertically
) {
Checkbox(checked = item.checked)
BasicText(text = item.text)
}
}
}
This results in:xxfast
06/07/2023, 11:44 AMsrc/commonMain/resources
directory and this is included in andorid sourcesets with
android {
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/resources")
}
However, now agp complaints with
AGPBI: {"kind":"error","text":"The file name must end with .xml","sources":[{"file":"/Users/TFNX46/Developer/MULTIPLATFORM/NYTimesKMP/app/src/commonMain/resources/fonts/CheltenhamBold.ttf"}],"tool":"Resource and asset merger"}
Execution failed for task ':app:packageDebugResources'.
Am I missing a configuration? I'm using agp 8.0.1 with gradle 8.0adte
06/07/2023, 12:31 PMfocusRequester.requestFocus()
in the tab click event, I think the new content isn't yet on screen so focus requester doesn't work
I tried using LaunchedEffect
but I get a warning that it shouldn't be performed during the composition (which makes sense)Arjan van Wieringen
06/07/2023, 6:30 PMJavokhir Savriev
06/08/2023, 6:54 AMAyfri
06/08/2023, 9:14 AMfun main() = singleWindowApplication(
title = "Artificial Infiltration",
state = WindowState(width = 1600.dp, height = 900.dp, position = WindowPosition.Aligned(Alignment.Center)),
) {
MaterialTheme {
Login()
}
}
val purple500 = Color(0x5C415A)
@Composable
fun Login() {
Scaffold (
backgroundColor = purple500,
){
Text("Hello World!", style = TextStyle(fontSize = 96.sp))
}
}
But I still get a white background, I don't get what am I doing wrong ?simon ballantyne
06/08/2023, 10:14 AMadte
06/08/2023, 12:24 PMfrank
06/11/2023, 1:13 AMCards
?
Wanted behavior: When Drag the mouse in a single-click, select only the Cards
not the content. Suggestions for this?
fun filesCard(files: List<Directory> = listOf(), onOpenDoc: (Path) -> Unit) {
Card (modifier = Modifier.fillMaxHeight(0.9f).fillMaxWidth()) {
LazyColumn(modifier = Modifier.fillMaxHeight()) {
items(files) {file ->
Card(
backgroundColor = Color(245, 238, 254),
shape = RoundedCornerShape(8.dp),
modifier = Modifier
.padding(vertical = 4.dp, horizontal = 4.dp)
.combinedClickable(
onClick = {
println("Clicked File!")
},
onDoubleClick = {
onOpenDoc(file.path)
}
)
) {
Row {
Column(modifier = Modifier.padding(start = 8.dp)
) {
Text(file.name, fontWeight = FontWeight.Bold, modifier = Modifier.fillMaxWidth())
Text("..\\${file.relativePath}")
}
}
}
}
}
}
}
Michael Paus
06/11/2023, 8:01 AM512m
of memory? All my configuration attempts seem to be consistently ignored. I added -Xmx4096m
to the runtime configuration of the test, org.gradle.jvmargs=-Xmx4g
to gradle.properties and more but my test always ends with an OutOfMemoryError which is no surprise because a printout like this inside the test code
val env = Runtime.getRuntime()
println("Max Heap Size = maxMemory() = " + env.maxMemory()) //max heap size from -Xmx, i.e. is constant during runtime
always tells me that the test is running with just 512m
. I have the feeling that this 512m
limit is somewhere just hard coded and overwrites all external settings. Is that possible?martmists
06/13/2023, 9:15 PMCaused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
when using the run
task, is there any way to make it depend on the shadowJar task instead?
EDIT: Got it to depend on shadowJar, but for some reason kotlin isn't in any of the configurations?Ch8n
06/14/2023, 7:46 PMpackageDmg
1:11:20 am: Executing 'packageDmg --stacktrace'...
> Task :checkRuntime UP-TO-DATE
> Task :createRuntimeImage UP-TO-DATE
> Task :compileKotlinJvm UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :jvmProcessResources UP-TO-DATE
> Task :jvmMainClasses UP-TO-DATE
> Task :jvmJar UP-TO-DATE
> Task :prepareAppResources NO-SOURCE
> Task :unpackDefaultComposeDesktopJvmApplicationResources UP-TO-DATE
> Task :createDistributable UP-TO-DATE
> Task :packageDmg FAILED
8 actionable tasks: 1 executed, 7 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':packageDmg'.
> External tool execution failed:
* Command: [/Users/chetangupta/Library/Java/JavaVirtualMachines/temurin-19.0.2/Contents/Home/bin/jpackage, @/Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/tmp/packageDmg.args.txt]
* Working dir: []
* Exit code: 1
* Standard output log: /Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/logs/packageDmg/jpackage-2023-06-15-01-11-28-out.txt
* Error log: /Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/logs/packageDmg/jpackage-2023-06-15-01-11-28-err.txt
these logs are giving error value
WARNING: Using incubator modules: jdk.incubator.jpackage
java.io.IOException: Command [/usr/bin/hdiutil, attach, /var/folders/bt/qz_284cn3218q0rrftztswpc0000gr/T/jdk.incubator.jpackage4311202220842882891/images/DsaTrainer-tmp.dmg, -quiet, -mountroot, /var/folders/bt/qz_284cn3218q0rrftztswpc0000gr/T/jdk.incubator.jpackage4311202220842882891/images] exited with 1 code
I'm using embedded Jdk version openJDK 19.0.2.
my gradle contains
group = "dev.ch8n"
version = "1.0.1"
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "DsaTrainer"
packageVersion = "1.0.1"
val resourceDirectory = project.layout.projectDirectory.dir("src/jvmMain/resources")
appResourcesRootDir.set(resourceDirectory)
includeAllModules = true
val icon = resourceDirectory.file("images/brain.png")
macOS {
iconFile.set(icon)
}
}
}
}
Сергей Новоселецкий
06/15/2023, 10:20 AMKirill Grouchnikov
06/15/2023, 1:36 PMLefix2
06/15/2023, 3:15 PM@Composable
fun ExpandableLabeledBox (
modifier: Modifier = Modifier,
expanded: Boolean = true,
onExpandedChanged: (Boolean) -> Unit,
label: @Composable (RowScope.() -> Unit)? = null,
content: @Composable ()->Unit
) {
val icon = if (expanded) Icons.Default.ExpandLess else Icons.Default.ExpandMore
val color = MaterialTheme.colors.primary
val clipShape = RoundedCornerShape(5.dp)
// The line to change
val topSurfaceHeight by animateDpAsState(if (expanded) 180.dp else 35.dp)
Surface(
modifier = modifier
.clip(clipShape)
.border(1.dp, color, clipShape)
.height(topSurfaceHeight)
) {
Column(modifier = Modifier.fillMaxWidth()) {
// Label
Surface(
modifier = Modifier
.clickable(onClick = { onExpandedChanged(!expanded) }),
color = color
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(IntrinsicSize.Min)
.padding(5.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp, Alignment.Start),
)
{
Icon(icon, null)
label?.invoke(this)
}
}
// Content
Box(modifier = Modifier.padding(10.dp)) {
content()
}
}
}
}
As you can see, I'm stuck with the animated size.
35.dp should be the height of the label
180.dp should be the height of the label + the height of the content.
Also, perhaps my approach of cliping all content into a surface is bad....
How will you achieve that?Neon
06/18/2023, 1:58 PMYan Pujante
06/18/2023, 6:39 PMfun CoroutineScope.uiTimer(period: Duration,
block: suspend CoroutineScope.() -> Unit): Job {
return launch(Dispatchers.Main) {
while(isActive)
{
delay(period.inWholeMilliseconds)
if(isActive)
block(this)
}
}
}
which now fails with this error: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
Since it is a desktop app, I am not sure that the suggestion is the right one... the whole point was to create a timer that runs in the UI thread. Any idea what is the "right" way to do this with a more recent version of compose?Malachi
06/18/2023, 11:38 PMit
only ever registered the first key pressed, as if the previous keystrokes were not saved. Did I miss something in how this works?
example of what I'm trying to do (if needed, I can provide more than just the barebones) :
var textSaver1 by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue()) }
. . .create 15 more
var textSavers1Through4 = mutableListOf(textsaver1, textsaver2, textsaver3, textsaver4)
Box {
OutlinedTextField( value = textSavers1Through4[0],
onValueChange = {
textSavers1Through4[0] = it
}
)
}
In case it matters, I'm using Kotlin version 1.8.20 and compose version 1.4.0. (And just to be clear - it works as expected if I don't use the mutable list, I'm just confused as to why the mutable list seems to make it not work)Timo Drick
06/19/2023, 9:57 AM