• Colton Idle

    Colton Idle

    1 year ago
    I have a screen with a viewPager from accompanist. One thing that I'm having trouble with is syncing my viewModel.currentPage and rememberPagerState.currentPage, and remembered that one of the points of compose is single source of truth.
    @Composable
    fun SignUpScreen(
        viewModel: SignUpViewModel = hiltViewModel()
    ) {
        val pagerState = rememberPagerState(5)
    In order to have a single source of truth, should I just move
    val pagerState = rememberPagerState(5)
    into my ViewModel?
    Colton Idle
    Shakil Karim
    +3
    17 replies
    Copy to Clipboard
  • u

    ursus

    1 year ago
    I have a 3rd party sdk which provides a Fragment subclass I cannot change. Can I somehow wrap it in
    AndroidView
    and make all the fragment lifecycle work? (Since they don't provide a View)
    u
    e
    +2
    12 replies
    Copy to Clipboard
  • Colton Idle

    Colton Idle

    1 year ago
    I have a problem with what I thought would be a simple example I tried to write up for compose. If you are well versed in mutableStateListOf I could use your help. Code in thread.
    Colton Idle
    Nathan Castlehow
    +1
    18 replies
    Copy to Clipboard
  • b

    Berkeli Alashov

    1 year ago
    Is there a way to have a special
    BackHandler
    that consumes back calls before the inner most composable? My use case is I have a
    BottomSheetScaffold
    at the root of my app (Theme>BottomSheet>Home>NavHost) and I want to close the sheet on back clicks. But BackHandler defined in BottomSheet doesn't get invoked until all back handlers deeper in the tree are used (in my case, NavHost consumes before BottomSheet, until the first destination is reached / nav stack cleared).
    b
    e
    +3
    23 replies
    Copy to Clipboard
  • e

    eygraber

    1 year ago
    Is there anything special I need to do to prevent a non-state parameter to a composable function from messing with recomposition/skipping? For example:
    @Composable
    fun Parent(state: State, eventEmitter: EventEmitter<Event>)
    eventEmitter
    will always be the same instance for a given composition, and uses an identity based
    equals
    and
    hashCode
    . Is there anything else that I need to do? Note that I can't use
    CompositionLocal
    here because a lot of the events I need to emit occur in non @Composablelambdas (e.g.
    onClick
    ).
    e
    Zach Klippenstein (he/him) [MOD]
    2 replies
    Copy to Clipboard
  • Colton Idle

    Colton Idle

    1 year ago
    How can I place an image on the screen with a concrete height (140.dp in this case) which then affects the width of the image, but I want to offset the image alllllll the way on the left. Right now I hardcoded it to -200.dp and it works great on my pixel5, but running it on the emulator, it doesn't get pushed off the screen entirely. Do I have to try to measure the width somehow after height is applied and set offset that way?
    Box() {
        Image(
            modifier = Modifier.height(140.dp).offset(x = (-200).dp),
            painter = painterResource(id = com.myapp.myresources.R.drawable.catdog),
            contentDescription = null)
    }
    Colton Idle
    m
    +2
    47 replies
    Copy to Clipboard
  • a

    Ayfri

    1 year ago
    Hi, what is
    dp
    ?
    a
    gildor
    2 replies
    Copy to Clipboard
  • iamthevoid

    iamthevoid

    1 year ago
    Is there in compose default android AlertDialog realization? I mean realization that include native dialog buttons style, title and text styles etc? Looks like that in compose AlertDialog i should customize style almost completely and it is perfect! But what if am i want only pass strings and actions into to see android native alert dialog?
    iamthevoid
    a
    3 replies
    Copy to Clipboard
  • m

    Mohamed Ibrahim

    1 year ago
    So I have a question about the XML selector drawable is it the same use in Compose or there something I miss? basically I need to reflect an icon selection in a group of items
    m
    Zach Klippenstein (he/him) [MOD]
    2 replies
    Copy to Clipboard
  • Napa Ram

    Napa Ram

    1 year ago
    Hi Everyone, I want to create separate Compose Component Library and then use it in my Project, in some case i want to override the compose component from Product app. can anyone help me in this case
    Napa Ram
    Dominaezzz
    4 replies
    Copy to Clipboard