• Nat Strangerweather

    Nat Strangerweather

    1 year ago
    Hi, I have a list of composables that look like this (please see above). I have a Boolean called isDisabled, and I want to assign it to other composables when I select one of them. How can I achieve that? I have now spent two weeks trying everything I can think of, but with no success.
    Nat Strangerweather
    Foso
    2 replies
    Copy to Clipboard
  • SrSouza

    SrSouza

    1 year ago
    HI folks, I was looking for a Table composable in the Internet, I found the DataTable but seems that was removed from the Compose Material, what composable is replacing it?
    SrSouza
    Adam Powell
    +1
    3 replies
    Copy to Clipboard
  • b

    Bradleycorn

    1 year ago
    Is there something equivalent to
    remember()
    but that launches its
    calculation
    in a coroutine scoped to the composable? Something like:
    val myVal by remember(viewModel) {
        viewModel.someSuspendingMethod()
    }
    My use case is that I have a
    suspend
    method in a ViewModel who’s return value I need to
    remember
    . Sure I could make the ViewModel method a “normal” method and use
    viewModelScope
    to launch a coroutine, but that is going to be scoped to the ViewModel, which itself is scoped to the Activity. I want it to be scoped to the composable (so that if the composable is removed from the tree, the coroutine is canceled). I guess I could use
    produceState
    for this? Is that the best way?
    val myVal by produceState(initialValue = "Loading...", subject = viewModel) {
       value = viewModel.someSuspendingMethod()
    }
    b
    Zach Klippenstein (he/him) [MOD]
    +1
    18 replies
    Copy to Clipboard
  • b

    Bradleycorn

    1 year ago
    If I could convince someone here to give me a nickel every time I write
    TextView("Some Text", modifier = …)
    instead of
    Text("Some Text", modifier = …)
    … man I’d be 💰
    b
    Halil Ozercan
    2 replies
    Copy to Clipboard
  • Grigoriev Dmitriy

    Grigoriev Dmitriy

    1 year ago
    Guys, after migration to alpha08 I got the error "Unexpected exception thrown by non-Glide code" on the screen with GlideImage from Accompanist. Has anyone had a similar problem?
    Grigoriev Dmitriy
    1 replies
    Copy to Clipboard
  • Vsevolod Ganin

    Vsevolod Ganin

    1 year ago
    Is there a way to tell is a composable running in an initial composition or a recomposition? I’m building yet another screen transition composable based on
    Crossfade
    and I want it not animate anything on initial composition
    Vsevolod Ganin
    Sean McQuillan [G]
    +4
    14 replies
    Copy to Clipboard
  • Colton Idle

    Colton Idle

    1 year ago
    I have a list that I want to display, but each item in the list consists of a header and a sub list. This works, but I don't think the inner forEach loop is done correctly (this looks like it's not recycling the inner list)
    LazyColumn {
        item {
            Text("MAIN HEADER")
        }
        items(mylist.sections) { section: MyClass.Section ->
            Text(section.title)
            section.subsections.forEach {
                Text(it.body)
            }
        }
    }
    this does not work, but it's what I expected I should do
    LazyColumn {
        item {
            Text("MAIN HEADER")
        }
        items(mylist.sections) { section: MyClass.Section ->
            Text(section.title)
            item(sec.subsections) {
                Text(it.body)
            }
        }
    }
    Colton Idle
    Andrey Kulikov
    13 replies
    Copy to Clipboard
  • Nat Strangerweather

    Nat Strangerweather

    1 year ago
    compose-samples/Grid.kt at 1630f6b35ac9e25fb3cd3a64208d7c9afaaaedc5 · android/compose-samples (github.com) Layout is "undefined reference". What am I missing?
    Nat Strangerweather
    l
    2 replies
    Copy to Clipboard
  • k

    Kshitij Patil

    1 year ago
    I'm using
    exoplayer
    with compose and for some reason the video is not getting shown. The audio starts playing as soon as the composable is rendered but video is not working. I've tried the latest version and
    2.11.7
    version of exoplayer and I'm currently using compose
    alpha07
    val context = ContextAmbient.current
    val exoPlayer = remember(mediaUri) {
        SimpleExoPlayer.Builder(context)
            .build()
            .apply {
                val dataSourceFactory: DataSource.Factory = DefaultDataSourceFactory(
                    context,
                    Util.getUserAgent(context, context.packageName)
                )
                val source = HlsMediaSource.Factory(dataSourceFactory)
                    .createMediaSource(mediaUri.toUri())
                this.prepare(source)
            }
    }
    
    Box(
        modifier = Modifier.preferredSize(244.dp)
            .padding(vertical = 24.dp, horizontal = 8.dp)
            .clip(RoundedCornerShape(12.dp)),
    ) {
        AndroidView(
            viewBlock = { context ->
                PlayerView(context).apply {
                    layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
                    useController = false
                    resizeMode = RESIZE_MODE_ZOOM
                    player = exoPlayer
                    exoPlayer.playWhenReady = true
                }
            },
            modifier = Modifier.fillMaxSize()
        )
    }
    
    onDispose {
        exoPlayer.stop()
        exoPlayer.release()
    }
    Here is my implementation snippet, any help would be appreciated. Thanks!
    k
    1 replies
    Copy to Clipboard
  • d

    Daniele B

    1 year ago
    Trying to summarize the difference between the apps of the “past” and the apps of the “future”:
    d
    j
    25 replies
    Copy to Clipboard