lisawray/groupie

Support for Jetpack-Compose?

leggomymeggos opened this issue ยท 7 comments

I'm working on a project that uses Groupie. We're also working on moving toward Jetpack-Compose for most of our views. Does Groupie support Jetpack-Compose already? If not, are there plans to support it in the future?

AFAIK Groupie is primarily a way to render items in a RecyclerView using a unified generic adapter that is capable of handling groups and items of any kind;

Jetpack Compose uses a completely different mechanism (LazyColumn and subcomposition) so I personally don't think they have much in common. What particular features are you looking for that isn't directly supported by LazyColumn or LazyGrid?

I'm not looking for functionality not supported by Compose; mostly wondering if there's guidance on mixing Groupie and Compose. I'd like to move toward Compose incrementally instead of replacing the entire Groupie list at once.

However, I might be thinking about this the wrong way ๐Ÿ˜… It seems like this approach would work

You mean ComposeItem for ComposeView, just like BindableItem for ViewBinding,

Well I'm not sure when you'd ever want to mix a RecyclerView with a LazyColumn. ๐Ÿค”

@Zhuinden Well, we have a list of lists, all using Groupie. I'm hoping we can replace one child list at a time before tackling the parent list. It would be a temporary state in order to incrementally transition to Compose. It would be even better if we could replace the individual items in the child lists with Compose before updating the child list itself. Otherwise you're right - I don't want to mix a RecyclerView with a LazyColumn ๐Ÿ˜€

@yshrsmz A ComposableItem could be great! I can definitely see it reducing boilerplate when transitioning to LazyColumn.

Otherwise, it seems like we could use ComposableView in our Groupie xml layouts to incrementally transition to Compose

From the compose in fragments documentation I think one of the key things here would be to make sure that you're disposing of the composable manually via AbstractComposeView.disposeComposition, probably when the view is unbound.

Great callout, we'll be sure to do that. Thanks!