https://kotlinlang.org
Join Slack
anyone know how to compare a KType to a actual type? I want to say something like `if( someProp.retu...
t

TwoClocks

over 4 years ago
anyone know how to compare a KType to a actual type? I want to say something like
if( someProp.returnType == Double::class )
In this case I could create an instance of a
Double
and get it's type... but pretend the type is of a class that it's not easy/possible to get an instance of easily.
t
d
  • 2
  • 2
  • 448
how do I listen to a mutableStateFlow object from an Activity? I only want the activity to act on it...
o

oday

over 3 years ago
how do I listen to a mutableStateFlow object from an Activity? I only want the activity to act on it if it has changed into something other than the default value
o
a
o
  • 3
  • 20
  • 447
Basic question: I want a column half width against the right side of the view/parent. The fillMaxWid...
t

tylerwilson

over 4 years ago
Basic question: I want a column half width against the right side of the view/parent. The fillMaxWidth(0.5f) is perfect for the width, but there is no offsetMaxWidth and the offset(x = ) expects dp. What is the simplest way to calc the offset or have it start in the middle? Thanks!
t
a
+2
  • 4
  • 5
  • 447
Has anyone built (or seen) a Kotlin Multiplatform library for compressing data? I need to compress a...
j

Justin

about 5 years ago
Has anyone built (or seen) a Kotlin Multiplatform library for compressing data? I need to compress and decompress strings on iOS and JVM. Both of those platforms seem to have their own GZIP implementations, but if someone has already created something like this, I'd be inclined to check it out before writing it myself.
j
m
r
  • 3
  • 7
  • 447
Hello! I have a question about font rendering on iOS. It is very different from the native renderin...
a

Alex Askerov

over 1 year ago
Hello! I have a question about font rendering on iOS. It is very different from the native rendering. It seems like it's the same font, but the font-kerning is not the same. Maybe something else is at play, but the kerning is what catches the eye the most. This is quite an important issue for us because we are integrating the compose screen into an already existing app. Inconsistency in font rendering is not what we want, and our design team fairly unhappy about it. As an example, I've attached two screenshots. The first one is SwiftUI, and the second one is Compose. Both are just default texts with no additional settings and different font sizes, ranging from 10 to 20. Maybe someone have any ideas how to fix it on our side. Is there any plans for making font rendering closer to the native one? Thanks!
šŸ‘€ 1
a
k
+2
  • 4
  • 18
  • 446
I’m saving in GItlab CI cache folder: `.gradle/caches/` which rapidly grows from 40k to 400k files d...
n

Nick Kleban

almost 2 years ago
I’m saving in GItlab CI cache folder:
.gradle/caches/
which rapidly grows from 40k to 400k files during a day. And saving\restoring cache takes quite a lot of time. Is there any sensible way to optimise stored cache?
n
e
+2
  • 4
  • 16
  • 446
Small follow-up on my journey of using `HTMX` and `kotlinx-html`. Turns out it is not difficult to c...
p

Peter

about 2 years ago
Small follow-up on my journey of using
HTMX
and
kotlinx-html
. Turns out it is not difficult to create inner html snippets using the
filter
option. Simple example:
fun createInnerUL(block: UL.() -> Unit): String {
    var first = true
    return createHTML().filter {
        if (first && it.tagName == "ul") {
            first = false
            SKIP
        } else {
            PASS
        }
    }.ul { block() }
}
val a = createInnerUL {
    li { +"one" }
    li { +"two" }
    li {
        ul {
            li {
                +"two-a"
            }
        }
    }
}
println(a)

<li>one</li>
<li>two</li>
<li>
  <ul>
    <li>two-a</li>
  </ul>
</li>
p
a
r
  • 3
  • 7
  • 446
Hey, I have trouble with Koin and iOS. I init Koin on startup (in iOSApp#init) but when I call injec...
l

Louis

over 2 years ago
Hey, I have trouble with Koin and iOS. I init Koin on startup (in iOSApp#init) but when I call inject later I have : KoinApplication has not been started. Do you have any idea why I have this error?
šŸ‘€ 1
l
a
m
  • 3
  • 2
  • 446
Is there any way to "throat" or "debounce" when user click on a button (in Android) to avoid multi-c...
p

Pablo

over 4 years ago
Is there any way to "throat" or "debounce" when user click on a button (in Android) to avoid multi-clicks? I've found something like this
fun <T> debounce(
    delayMillis: Long = 300L,
    scope: CoroutineScope,
    action: (T) -> Unit
): (T) -> Unit {
    var debounceJob: Job? = null
    return { param: T ->
        if (debounceJob == null) {
            debounceJob = scope.launch {
                action(param)
                delay(delayMillis)
                debounceJob = null
            }
        }
    }
}
Where I can do
fun setDebounceListener(view: Button, onClickListener: View.OnClickListener) {
    val clickWithDebounce: (view: View) -> Unit =
        debounce(scope = MainScope()) {
            onClickListener.onClick(it)
        }
    view.setOnClickListener(clickWithDebounce)
}
Does it make sense to use debounce here? It's just to avoid double click on a Button
p
l
  • 2
  • 99
  • 446
hi guys! how you manage build flavors/variants in KMM projects? particularly multi dimensional flavo...
d

deviant

over 4 years ago
hi guys! how you manage build flavors/variants in KMM projects? particularly multi dimensional flavors e.g. "staging/debug", "free/enterprise" etc
d
t
e
  • 3
  • 4
  • 446
Previous150151152Next

kotlinlang

A modern programming language that makes developers happier.

Powered by