• Marcin Środa

    Marcin Środa

    2 years ago
    How to deal with lifecycle in Composable? I’ve based on
    onActive
    /
    onCommit
    /
    onDispose
    , but what about something similar to
    onPause
    /
    onResume
    ? I’m looking for something that will tell me that the activity has gone background / foreground.
    Marcin Środa
    1 replies
    Copy to Clipboard
  • JulianK

    JulianK

    2 years ago
    Is there a way to remember scroll state in LazyColumnFor? In ScrollableColumn, i can just pull out scrollState, LazyFor does not provide this parameter. When i try to use Modifier.verticalScroll() on LazyColumnFor using a saved scroll state, scroll behaviour is messed up (no acceleration when 'flinging' the page). Anybody uses LazyColumnFor with a saved scroll state?
    JulianK
    matvei
    +2
    9 replies
    Copy to Clipboard
  • Namig Tahmazli

    Namig Tahmazli

    2 years ago
    Hi. When I read documentation of each class or function, some samples are indicated there but I do not know how I can have a look at it. For Instance.
    * [key] is a utility composable that is used to "group" or "key" a block of execution inside of a
     * composition. This is sometimes needed for correctness inside of control-flow that may cause a
     * given composable invocation to execute more than once during composition.
     *
     * The value for a key *does not need to be globally unique*, and needs only be unique amongst the
     * invocations of [key] *at that point* in composition.
     *
     * For instance, consider the following example:
     *
     * @sample androidx.compose.runtime.samples.locallyUniqueKeys
    Here I do not know how I can check
    locallyUniqueKeys
    to understand the given sample better. Do you know where I can find them?
    Namig Tahmazli
    Andrey Kulikov
    4 replies
    Copy to Clipboard
  • j

    Julius Marozas

    2 years ago
    As I understand when some composable "X" uses
    value
    on some
    State<T>
    "S", then the Compose runtime automatically recomposes X when S changes. Potentially bypassing recomposing any composables that just forward S to X without calling
    value
    . In my app, I have a "container composables" that are responsible for observing streams from a view model and passing the observed values to children composables. In one of the containers I have
    StateFlow<List<T>>.collectAsState()
    and I pass
    State<List<T>>
    to children of the container. What should I do, if I want to pass a boolean indicating whether
    List<T>
    is empty? Can I somehow create a new
    State<Boolean>
    ? And in general, should I always prefer to pass
    State<T>
    to composables instead of just
    T
    ?
    j
    jim
    4 replies
    Copy to Clipboard
  • Sergey Y.

    Sergey Y.

    2 years ago
    Hi. Is there any modifier that could work as decoration to the composable views? I want to recreate the SwiftUI's redacted placeholder API. Ideally, I need some modifier that could return me the boundaries of an underlying view hierarchy(only top-level) and be able to draw some geometrical figures ontop. Or what way should I look to create this modifier my own? Thanks.
    Sergey Y.
    jim
    +2
    10 replies
    Copy to Clipboard
  • JD

    JD

    2 years ago
    While trying the the Kotlin State Codelab i have noticed the TextField component never seems to be able to delete the first character in the field. This happens only on the first launch when the app is launched the back arrow seems to leave the first character. Has anyone else faced this issue? Video representation below
    JD
    Siyamed
    4 replies
    Copy to Clipboard
  • JD

    JD

    2 years ago
    I am facing issue with the imeAction in the State Kotlin CodeLab. When done is pressed at that time the value of text is always returned empty. Also, when viewed in the imeAction the value of text comes back as empty. Source code:
    onImeActionPerformed = { action, softKeyboardController ->
        if (action == ImeAction.Done) {
            onImeAction()
            softKeyboardController?.hideSoftwareKeyboard()
        }
    },
    Handling on the submit callback:
    val submit = {
        onItemComplete(TodoItem(text))
        setIcon(TodoIcon.Default)
        setText("")
    }
    Video:
    JD
    1 replies
    Copy to Clipboard
  • Mehmet Peker

    Mehmet Peker

    2 years ago
    Hello everyone, im trying add jetpack compose to my an existing app but i cant. I have an error related of room compiler(annotation processors).When compose is enabled annotation processor get error.Can anyone help me?
    Mehmet Peker
    gildor
    12 replies
    Copy to Clipboard
  • m

    MBegemot

    2 years ago
    Hi composers. Today I simple changed a Checkbox into a Switch and now the switch oscillates between it's two states on his own. As the parameters are equal for both widgets, I guess it should be a bug.
    m
    1 replies
    Copy to Clipboard
  • m

    MBegemot

    2 years ago
    Honestly there is no much to share simply change Checkbox keyword for Switch....
    Row(Modifier.padding(5.dp)) {
        Text("Selected")
        //Switch(checked = lselected, onCheckedChange = { lselected = !lselected} )
        Checkbox(checked = lselected, onCheckedChange = { lselected = !lselected} )
        Text("Unselected")
    }
    m
    Yann Badoual
    +1
    7 replies
    Copy to Clipboard