https://kotlinlang.org
Join Slack
Running Kotlin coroutines on Project Loom's virtual threads: <https://kt.academy/article/dispatcher-...
j

janvladimirmostert

almost 3 years ago
Running Kotlin coroutines on Project Loom's virtual threads: https://kt.academy/article/dispatcher-loom
👌 6
👏🏾 1
💡 4
👏 3
➕ 1
j
c
+2
  • 4
  • 80
  • 449
I don't know how to describe my problem, but I try it: When my App opens, it checks for a new versio...
j

Jan

over 3 years ago
I don't know how to describe my problem, but I try it: When my App opens, it checks for a new version and if there's no new version it continues with the main app which also gets some data from an api. Now this should be a pretty easy task and the things being downloaded are very small. But sometimes with my wifi (and worse with only mobile data). My app takes very long to load. I don't know whats causing this. I mean the rendering is independent of the network thing it should give me something but its just a white screen
j
k
  • 2
  • 9
  • 449
I’m trying to import the kotlinx datetime library into a jupyter notebook. I thought I understand t...
c

Carter

over 3 years ago
I’m trying to import the kotlinx datetime library into a jupyter notebook. I thought I understand the syntax, but apparently not.
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2")
%useLatestDescriptors
%use lets-plot

import java.util.Random
import kotlinx.datetime.Instant
Running that yields the error
Line_214.jupyter-kts (6:25 - 32) Unresolved reference: Instant
What am I missing?
c
a
i
  • 3
  • 13
  • 449
Hi everyone, I’m getting `IllegalStateException Flow invariant is violated emission from another co...
a

AG

over 5 years ago
Hi everyone, I’m getting
IllegalStateException Flow invariant is violated emission from another coroutine is detected
when running this code, is it possible to fix this without using channelFlow ?
flow<Action> {
    val result = downloadFile(url, directory) { event: ProgressEvent ->
        emit(DownloadProgress(event))
    }
    emit(DownloadFinished("path"))
}.onEach { L.d(it) }.launchIn(viewLifecycleOwner.lifecycleScope)
downloadFile method
suspend fun downloadFile(
    url: String, fileDir: String, onProgressEvent: suspend (event: ProgressEvent) -> Unit = {}) {
 val progressChannel = Channel<ProgressEvent>()

 CoroutineScope(coroutineContext).launch {
     progressChannel.consumeAsFlow().collect { onProgressEvent.invoke(it) }
  }
/* rest of the code */
}
a
z
  • 2
  • 5
  • 449
Hi, Is there any minimal examples to use Proguard Gradle Plugin with Kotlin/JVM with no dependencies...
a

Ahmed Riyadh

over 1 year ago
Hi, Is there any minimal examples to use Proguard Gradle Plugin with Kotlin/JVM with no dependencies to reduce the size of the jar (by removing unused things like classes) which is already used by Android and Compose Desktop (JVM) more details are on the thread of this message. Thank you.
a
c
  • 2
  • 10
  • 448
I have strange behaviour of one of my screens when I added a WebView - it for some reason has wrong ...
e

electrolobzik

almost 2 years ago
I have strange behaviour of one of my screens when I added a WebView - it for some reason has wrong background while the webpage is loading. Why may it happen? Can WebView have wrong position during loading?
e
t
+3
  • 5
  • 24
  • 448
I have a `ClickableText` (with an annotated string), and I only handle clicks on a certain portion ...
b

Bradleycorn

about 4 years ago
I have a
ClickableText
(with an annotated string), and I only handle clicks on a certain portion of the string, like this:
onClick = { pos ->
    if (pos in linkStart..linkEnd) {
        onLoginClicked()
    }
}
How can I test this? I need a way in the test to click on a certain position (string index) in the text.
performClick()
doesn’t take any parameters that I could use to click at a certain position. Using
performTouchInput()
let’s me move by a number of pixels, but I’m not sure how that helps since I need to click based on string position.
b
b
+2
  • 4
  • 16
  • 448
I’m using `LazyColumn` with `itemsIndexed` with keys and have `Modifier.animateItemPlacement()` on m...
r

Rick Regan

about 3 years ago
I’m using
LazyColumn
with
itemsIndexed
with keys and have
Modifier.animateItemPlacement()
on my items. The list of items is immutable inside a mutableStateOf(). I can delete items one at a time (replacing with a new immutable list) and the animations appear to work as expected. However, I am confused by this comment from the documentation on animateItemPlacement(): “Aside from reorderings, item animations for additions and removals is currently in development.” (I am using Compose 1.3.0-beta03 and Material 3 1.0.0-beta03, the version prior to what just came out today.) Is that note out of date, does it not apply to my case, or am I just lucky?
👀 1
r
a
  • 2
  • 4
  • 448
Whats the best way to download multiple files in coroutines with a fixed amount of parallel download...
j

Jan

over 3 years ago
Whats the best way to download multiple files in coroutines with a fixed amount of parallel downloads. So there are like 1000 files and I want to download them in parallel but only 4 at a time
j
t
+4
  • 6
  • 5
  • 448
Getting below error when accessing `layoutCoordinates.positionInRoot()` . This is only happening in ...
t

theapache64

over 3 years ago
Getting below error when accessing
layoutCoordinates.positionInRoot()
. This is only happening in release build.
Fatal Exception: java.lang.IllegalStateException
LayoutCoordinate operations are only valid when isAttached is true
t
d
  • 2
  • 15
  • 448
Previous149150151Next

kotlinlang

A modern programming language that makes developers happier.

Powered by