• Deepak Gahlot

    Deepak Gahlot

    1 year ago
    Is there a way in LazyColumn to scroll to a particular position in an Item. I'm working on building Expandable Item List. And each Expandable Card contains multiple Questions that user has to fill the answer. Once the user submit the answer, I check the validations from server and show the error is respective answer. Now i need a way to scroll to that particular answer and then keep on moving to the next error. Before COMPOSE i used to do this via requestFocus using a recyclerview. i have been going through documentation of compose and unable to find a way to build this
    Deepak Gahlot
    s
    +3
    20 replies
    Copy to Clipboard
  • Deepak Gahlot

    Deepak Gahlot

    1 year ago
    I understand that there is a way to scroll to the item, but nothing if need to scroll to a particular content in that item(Expandable vIEW)
    Deepak Gahlot
    Andrey Kulikov
    2 replies
    Copy to Clipboard
  • Yuri Drigin

    Yuri Drigin

    1 year ago
    Why
    onCommit
    crashed with
    Composition re quires an active composition context
    ?
    @Composable
    fun NetworkImage(
    		modifier: Modifier,
    		url: String?,
    		placeholder: Int
    ) {
    		var image by remember { mutableStateOf<ImageBitmap?>(null) }
    
    		onCommit {
    				val picasso = Picasso.get()
    Yuri Drigin
    Zach Klippenstein (he/him) [MOD]
    5 replies
    Copy to Clipboard
  • Archie

    Archie

    1 year ago
    Hi, is there a way to add listener to
    Transition
    ? I'd like to do an action after the new state have been reached something like:
    val transitionState = remember {
        MutableTransitionState(false)
    }
    
    val transition = updateTransition(transitionState)
    val scale by transition.animateFloat(
        transitionSpec = { spring(dampingRatio = Spring.DampingRatioMediumBouncy) }
    ) {
        when (it) {
            true -> 1f
            false -> 0f
        }
    }
    
    LaunchedEffect(viewModel, navController) {
       delay(1000)
       transitionState.targetState = true
       // Then I want to do an action after the animation finished
       // but I can't find a way to attached a listener to Transition.
    }
    Archie
    jim
    +1
    6 replies
    Copy to Clipboard
  • Sergey Y.

    Sergey Y.

    1 year ago
    Hi, I am working on some functionality in our application that requires the render of single-stroke fonts for cutting. Unfortunately android cannot display such fonts correctly, so we use the
    Freetype Harfbazz
    library to render individual glyphs as a sequence of vector paths. Now I'm looking for an option how this can be integrated into the pipeline of the standard android input system, and with the Compose(I'm considering CoreTextField). In the case of working with a regular
    EditText
    , it seems to me that I will need to rewrite everything from scratch(cursor, line break, context menu, text selection, etc.). But since the Compose has platform(android, desktop) implementations of text input, that means it uses abstractions around working with text. Which means it is should be possible to change implementation. I found an abstraction like Paragraph and its platform implementation for Android AndroidParagraph, which under the hood uses the TextLayout wrapper for StaticLayout class. And a MultiParagraph class that uses the above Paragraph. I would like to replace the implementation for the
    AndroidParagraph
    with my own but it seems that I do not see how this could be done. I would be apprecited any help. Thanks.
    Sergey Y.
    jim
    +1
    4 replies
    Copy to Clipboard
  • Mehdi Haghgoo

    Mehdi Haghgoo

    1 year ago
    Animation APIs in Compose seem very complicated. I literally don't understand any of what the inline docs say!
    Mehdi Haghgoo
    k
    +5
    12 replies
    Copy to Clipboard
  • d

    Daniele B

    1 year ago
    I realized there is a lot of confusion about the concept of “Single Source Of Truth”. In traditional Android development, we used to talk about SSoT in the context of the Repository. Can we please agree, and probably make it clear, that the SSoT in the context of JetpackCompose (and DeclarativeUIs), has nothing to do with the Repository (and the DataLayer), but only with the ViewModel? I keep hearing developers saying that the SSoT of an app is the DB, even in the context of JetpackCompose. How does that make sense? I am attaching a diagram, where I try to highlight the difference between AppState (which is part of the ViewModel) and Repository (which is part of the DataLayer), with particular reference to the D-KMP architecture. Any comment is very welcome.
    d
    Javier
    +3
    24 replies
    Copy to Clipboard
  • Mikołaj Kąkol

    Mikołaj Kąkol

    1 year ago
    it seams that
    rememberSaveableStateHolder
    is broken in somehow in alpha12. Consider example from here: https://github.com/androidx/androidx/blob/androidx-main/compose/runtime/runtime-sa[…]/compose/runtime/saveable/samples/SaveableStateHolderSamples.kt and change
    Box(modifier) {
                restorableStateHolder.SaveableStateProvider(currentScreen) {
                    content(currentScreen)
                }
           }
    to
    Box(modifier) {
                restorableStateHolder.SaveableStateProvider(currentScreen) {
                    Crossfade(targetState = currentScreen) {
                        content(it)
                    }
                }
            }
    you will notice that animation doesn’t work. If you will remove that state holder:
    Box(modifier) {
                Crossfade(targetState = currentScreen) {
                    content(it)
                }
            }
    crossfade works. So either
    stateholder
    is broken or
    crossfade
    . From what I unsderstand problem is that Crossfade implementation uses
    remember
    to store items to render during transition. What I wanted to achieve is some nice animation between screens. What to do? 🤔 🙀
    Mikołaj Kąkol
    Andrey Kulikov
    +1
    7 replies
    Copy to Clipboard
  • u

    utikeev

    1 year ago
    I've implemented custom Pager based on this implementation, but also supporting zoom and vertical pan for alpha11. In alpha12
    DragObserver
    got deprecated, but I didn't manage to properly migrate my implementation to new API. Using two
    draggable
    modifiers prevents from dragging simultaneously in both directions and zooming at the same time, while using
    pointerInput
    lacks was kind of tricky: •
    detectDragGestures
    lack
    onStart
    and
    velocity
    parameter in
    onEnd
    callback •
    drag
    function seems to allow more fine-grained setting up, but judging by
    detectDragGestures
    is also quite hard to handle. Also
    velocity
    has to be calculated somehow (isn't really clear) I'll attach deprecated snippet, which I currently use, and would be glad to know several directions on how it can be implemented with new API with the similar amount of code.
    u
    Andrey Kulikov
    +2
    9 replies
    Copy to Clipboard
  • k

    Ky

    1 year ago
    Hi, my BasicTextField composable and
    adjustPan
    are not behaving properly after the first focus. The first click, the composable is properly moved up but if you close the keyboard and click back into the field, it is now partially obscured by the keyboard. Has anyone run into this?
    k
    2 replies
    Copy to Clipboard