Building this in the old view system was NOT fun, ...
# compose
b
Building this in the old view system was NOT fun, and involved writing a custom LayoutManager for the main recycler view, and using some wild stuff to link 3 recycler views together (main view, one for the row header, and one for the column header) and keep their scrolls/flings in sync. I haven't tried it yet, but I wonder how much easier this will be in Compose?
โž• 2
t
Wow this looks like an interesting challenge to port to Compose. Complexity would mostly lie in connecting all the scroll states of the scrollable components together
c
I'm actually building a TV guide sort of thing in the view system and it is reallllly hard. I'm not sure how I would even attempt it compose, but would am curious to hear how someone like @Andrey Kulikov would go forward to build something like this. This is what I'm actually trying to build in legacy Android view land. So an additional piece of complexity is the fact that the column sizes can be variable sizes since a show can be 30 minutes long, or 60 minutes.
b
I dubbed my final custom view,
SpreadsheetView
๐Ÿ™‚ I feel your pain @Colton Idle. I didn't have to deal with cells that span multiple rows/columns like you do, and it was still a massive pain.
๐Ÿ‘ 1
a
that is currently not possible with Lazy components. there are no grids scrolling in both ways
๐Ÿ˜ฑ 1
but if all the cells are known to have the same fixed size maybe you donโ€™t need it at all and can just apply two Modifier.scollable() for each direction and just draw the content right on Canvas using the current offsets?
๐Ÿ’ก 1
there is still no DrawScope.drawText() but you can use the regular Android one for it for now with
drawIntoCanvas
b
interesting. In my case, the cells are all the same size, so I might be able to do something like that
s
that is currently not possible with Lazy components. there are no grids scrolling in both ways
@Andrey Kulikov but is it planned to do such functionality? โ˜บ๏ธ
b
yes. we need
LazySpreadsheetLayout
๐Ÿ˜‰
๐Ÿ’ฏ 1
โค๏ธ 1
c
LazyTVGuide
if the Android team is taking suggestions ๐Ÿ˜‚
b
haha
s
I bet that it will be in demand on android tv ๐Ÿ˜„
๐Ÿคฃ 1
๐Ÿ˜„ 1
a
No, it is not planned for now. We donโ€™t support even simpler staggered grids yet. Feel free to create a 3rt party library for it on top of SubcomposeLayout ๐Ÿ™‚
๐Ÿ‘ 1
s
Interestingly, I only found one sample with SubcomposeLayout, hopefully it will be described in the documentation. How to use it, etc ๐Ÿ˜€
h
r
@Zach Klippenstein (he/him) [MOD] Hi have you ever implemented excel like scrollable layout with frozen headers like this?

https://raw.githubusercontent.com/zhouchaoyuan/excelPanel/master/app/src/main/assets/roomFormDemo.gifโ–พ

z
Nope