Status Update
Comments
ml...@gmail.com <ml...@gmail.com> #2
jg...@google.com <jg...@google.com> #3
Hey, thanks for the feedback! There's a couple of things we're working on at the moment to try and help this out, both to reduce the amount of code required to implement common designs, and to provide a better Kotlin API.
We've recently released the first alpha of
We're also building up a Material component library for Tiles (androidx.wear.tiles:tiles-material), and just released the first alpha version yesterday. It's still using Builders throughout, but it aims to provide consistent Wear Material components for Tiles, so should also reduce some of the code needed to build up Tiles.
It's still very early days on both projects, but it'd be great to get initial feedback on these projects too!
jo...@gmail.com <jo...@gmail.com> #4
Awesome! I'm excited to try it out :) thanks for your work!
jo...@gmail.com <jo...@gmail.com> #5
So Glance will also work for normal appwidgets? That's even more awesome!
jg...@google.com <jg...@google.com> #6
In general, yes. That said there's a few caveats:
- Using any of the target-specific Composables (e.g. androidx.glance.wear.tiles.curved.CurvedRow) will not work on other targets (your app will compile still, but it won't render).
- If you're just using the base set (e.g. the ones in androidx.glance), then the same code will work on both Tiles and Appwidgets, but you'll still need to test on both and tweak the layout so it renders well on both targets.
at...@google.com <at...@google.com> #7
Thanks for the feedback, Jolan! Please try out Tiles Material (there's a new
The underlying structure is the same as the OG Jetpack Tiles API, but it should be a lot easier to build Material-friendly layouts with the new one, and hopefully a lot less boilerplate.
(Glance: Tiles is still in development but it's still in alpha.)
Will close this ticket off. (I chose "fixed (verified)" as it's a feedback issue and the other statuses apply less.)
Description
First of all, thank you for putting in the effort to create the Wear Tiles API. However, as an avid Kotlin developer, I do feel like I need to express my concerns regarding the usability of the API.
Jetpack in combination with Kotlin is supposed to be an easy-to-read and Kotlinesque set of libraries that makes working with Android a breeze. This is the case, mostly, with useful extension functions all over and not to mention Jetpack Compose! That's where my concern comes into play regarding the relatively new Tiles API. The API can only be described by me and my fellow developers as a "Builder hell". Just look at any of your own examples:
There are no Kotlin features used and even for folks using Java it can only be described as "unpleasant to work with". There is boilerplate code everywhere, making the result messy and difficult to read.
Now maybe these builders are a form of preparation to be able to use Compose to create Tiles in the future. In that case, I'll take back my concerns. A Compose approach would convert the sample above to something like:
Which is clearer, more concise, and way easier to read. I'm curious to see whether this API is moving towards a ktx approach like this. I think it would invite developers more easily to create their own tiles for Wear compared to the current state of the API, which ultimately is better for the platform.