• j

    Julius Marozas

    2 years ago
    I've been reading the source code of Compose and found that in the
    rxjava2
    package the
    subscribeAsState
    function calls
    asState
    and it uses the
    onPreCommit
    hook. Why would the
    onCommit
    hook not work there? I don't really understand the use case of
    onPreCommit
    .
    j
    Adam Powell
    6 replies
    Copy to Clipboard
  • b

    Brett Best

    2 years ago
    I’m interested in this as well, is it possible to add an additional property to MaterialTheme e.g. Tertiary, Quaternary?https://kotlinlang.slack.com/archives/CJLTWPH7S/p1594707721231600
    b
    manueldidonna
    7 replies
    Copy to Clipboard
  • n

    nglauber

    2 years ago
    Dumb question of the day: Do I have to do something special to see the preview of my composable in the documentation? I mean this:
    /**
     * My Component
     *
     * @sample com.example.tempcompose.SimplePreview
     */
    @Composable
    fun MyComposable() { ... }
    
    @Preview
    @Composable
    fun SimplePreview() {
        MyComposable()
    }
    When I hit Cmd+Space I can see the sample code, but not the preview…
    n
    v
    +4
    12 replies
    Copy to Clipboard
  • Halil Ozercan

    Halil Ozercan

    2 years ago
    I came across a possible bug related to
    IconButton
    and
    Icon
    . I'm developing a VideoPlayer fully written in Compose and wanted to add on-screen play/pause button. These icons need to be differentiable on video, so that I chose to use white for icon colors and draw shadow around them. Code looks something like this
    IconButton(
        onClick = {
            mediaPlayer.toggle()
            playButtonUiState = mediaPlayer.isPlaying
        }
    ) {
        Icon(
            asset = if (playButtonUiState) Icons.Filled.Pause else Icons.Filled.PlayArrow,
            modifier = Modifier.drawShadow(elevation = 2.dp)
        )
    }
    Without shadow, everything seems like to work. State changes and icon is updated when clicked on the button. However, when I add shadow as in the example, icon stops changing. Functionality works but icon gets fixed to
    Pause
    . Is there something wrong with my code or is this might be a bug?
    Halil Ozercan
    Timo Drick
    +2
    7 replies
    Copy to Clipboard
  • pajatopmr

    pajatopmr

    2 years ago
    One of the first things I notice in my journey into the land of Compose (sample apps like Jetnews) is that there are two types of theme files, one legacy type referenced from the manifest file and one new type referenced as code files (e.g. Jetnewssample/app/src/main/java/com/example/jetnews/ui/theme/*.kt). My guess is that the legacy type will go away eventually to be replaced by the code file approach. Would this be a good guess? If not, what is the rational for having both approaches?
    pajatopmr
    andylamax
    +2
    8 replies
    Copy to Clipboard
  • l

    Loboda Deni

    2 years ago
    Hi. Is it possible to use this technology together with mvvm architecture?
    l
    Timo Drick
    11 replies
    Copy to Clipboard
  • Timo Drick

    Timo Drick

    2 years ago
    Just implemented a basic transition navigation "framework" in about 200 lines of code. It supports enter/exit transitions defined by a Modifier. So it is easy to define simple transitions. (Already defined are: fadein, fadeout, crossfade, slidein, slideout, roll right/left) For me again this shows that compose is amazing. But get the transition system working in an efficient way was very hard. I used the code from the Crossfade composable as base. And it works now fine but for me little bit of magic. Because i needed to make sure that during the transition animation the content composable is not recomposed. Implementation is here: https://gitlab.com/timod/compose-playground/-/blob/master/app/src/main/java/de/appsonair/compose/Navigation.kt https://gitlab.com/timod/compose-playground/-/blob/master/app/src/main/java/de/appsonair/compose/Transition.kt And a demo how to use is in the MainActivit.kt file.
    Timo Drick
    Zach Klippenstein (he/him) [MOD]
    9 replies
    Copy to Clipboard
  • cb

    cb

    2 years ago
    Nice! I'm implemented something this week, by extending
    Crossfade
    and allowing you to pass in a TransitionDefinition: https://gist.github.com/chrisbanes/c4d199a34366a4e13594f5f98d6e8620
    cb
    Timo Drick
    3 replies
    Copy to Clipboard
  • j

    Julius Marozas

    2 years ago
    I have noticed that there's no persistent bottom sheet composable. Are there any plans to implement it?
    j
    matvei
    4 replies
    Copy to Clipboard
  • henrikhorbovyi

    henrikhorbovyi

    2 years ago
    is
    @GenerateView
    annotation still available? 🤔
    henrikhorbovyi
    v
    +4
    11 replies
    Copy to Clipboard