Rosen Dimov
08/17/2020, 8:12 AMLazyColumnFor
, because I wanted to migrate an adapter which has two view types (both written in constraint layout). I migrated the XML definition of the CL to the equivalent ConstraintLayout
composable, using createRefs
for describing constraints, and start.linkTo
, top.linkTo
, etc. (part of 0.1.0-dev16 version). Scrolling was very slow, compared to the adapter approach where things are smooth. Here's a gist of the composable.
Here's some relevant code:
The activity which sets the root composable (the list) - grabs first a bunch of data from a Firestore and calls setContent
The list, based on LazyColumnFor
The repeating item - with ConstraintLayout, and with Row and Column
RoundedImage composable - a simple card view with circle shape
The customized button
2 - Have you considered taking an approach similar to JSX in React, something like files with both Kotlin code and some sort of markup for definition of the view itself. Seems like the main drawback of the composables is the nesting of objects that happens in code, and to me at least, it seems more natural to express certain hierarchy of components through a markup language (don't get me wrong, moving to composables in their current state is already a big step, just my thoughts as React dev π )
3 - For beginners like me, is it worth diving deep into things like activities, fragments, navigation in its stable state, lifecycles of fragments/activities, different kind of layouts, etc.? I'll probably not be working on professional Android projects (if I decide to take up mobile dev in my work) by the time stable version of compose is released (in the beginning of 2021, from what I know).
Thanks and have a great day! πcaelum19
08/17/2020, 8:27 AMcaelum19
08/17/2020, 8:28 AMRosen Dimov
08/17/2020, 8:45 AMRosen Dimov
08/17/2020, 8:48 AMDimension.value
and Dimension.fillToConstraints
only. And no refs and linkTo
anywhere?caelum19
08/17/2020, 10:03 AMRosen Dimov
08/17/2020, 10:25 AMMark Murphy
08/17/2020, 12:11 PMFor beginners like me, is it worth divingdeep into things like activities, fragments, navigation in its stable state, lifecycles of fragments/activities, different kind of layouts, etc.? Activities and their lifecycles still matter. Navigation will still matter, though using the Kotlin DSL, and its support for Compose has not yet shipped. The classic
View
system ("different kind of layouts") may still matter to an extent, simply because not everything will be Compose-ready soon (think WebView
, MapView
, ExoPlayer, etc.). So, ideally, you have at least rudimentary understanding of how views work, even if you skip the details of things like LinearLayout
.
Fragments can be used with Compose, though I think that will be more for people migrating from the classic View
system to Compose.Rosen Dimov
08/17/2020, 12:30 PMWallpostButton
composable is a simple button with an image and configurable text. Seems like performance is yet being tuned maybe?caelum19
08/17/2020, 12:34 PMRosen Dimov
08/17/2020, 1:16 PMLazyColumnFor
and the customized image and button as gists in my main post. I tried using a Box
, with a single column and text in it - yes, there's a significant difference now, but still the first few scrolls are laggy and scrolling speed is slower (yet smooth) than with adapter. And I forgot to mention - I'm testing on Nexus 5X.Adam Powell
08/17/2020, 1:54 PMromainguy
08/17/2020, 2:23 PMromainguy
08/17/2020, 2:23 PMcaelum19
08/17/2020, 3:21 PMHalil Ozercan
08/17/2020, 3:59 PMromainguy
08/17/2020, 4:12 PMRosen Dimov
08/17/2020, 4:50 PMLazyColumnFor
right now. Thanks!romainguy
08/17/2020, 4:53 PMConstraintLayout
or with Row/Column
as well?romainguy
08/17/2020, 4:53 PMHalil Ozercan
08/17/2020, 4:59 PMRosen Dimov
08/17/2020, 5:12 PMromainguy
08/17/2020, 5:53 PMRosen Dimov
08/17/2020, 6:32 PMromainguy
08/17/2020, 6:58 PMRosen Dimov
08/17/2020, 7:56 PMRosen Dimov
08/18/2020, 8:47 AMRosen Dimov
08/20/2020, 6:42 PM