<https://medium.com/@burakeregar/jetpack-compose-a...
# android
b
https://medium.com/@burakeregar/jetpack-compose-android-apps-without-xml-534d74448778 I wrote an article about Jetpack Compose which announced yesterday at Google I/O. Any feedback would greatly appreciated!
👍 4
p
Well that's pretty self explanatory. Whats interesting is how it really works under the hood. What does the plug-in exactly generate? Is it really not using the view system? Is it using surfaceview? How does scrolling work? Wasn't surfaceview free of the main thread restriction? Well that would enable large performance gains. How does layout measurement work? These are questions I'd find interesting to find an answer to
👍 2
r
@Paul Woitaschek Of course it’s using the view “system”. The XML isn’t magic, there’s underlying code that generates
View
type objects based on the XML definition. Compose is just a shortcut to generate those things from Kotlin DSL structures instead. `View`s will still work exactly like they always have. This isn’t a different graphical/layout/view system, this is just a different way to utilize the one that already exists.
b
I am looking forward to listening "Declarative UI patterns with Android Jetpack" talk today which will give us more context.
4
s
@rook I think Paul meant Android's View classes, and no, by default Compose will not use them , but will have interop with them.
1
r
@sngrekov Interesting. Can you link me to the source files where it shows that Compose does not generate View classes?
p
Yes, of cause somewhere it's using view. Each game uses views. (mostly exactly one surface). But from what I heard what's happening is fundamentally different to a regular app composed of multiple android.view.View classes. It does not seem to be a simple dsl
I'll check the source code later, I'm currently in the garden with the kids and browsing git doesnt work too well
r
I’m trying to browse through the AOSP source myself, but I’m not very familiar with it, so I can’t seem to find the Compose code. Although, you just mentioned exactly the point I was making. Everything is a
View
at some point. Nothing is different in Compose except for the way we go about having those `View`s created.
p
Well no. You can either go the traditional way and use layouts and views or you can draw on the surface like flutter
👍 1
Try to compile the sample app and use the layout inspector :)
n
Why not adopt and enhance anko ?
s
Anko is basically is syntax sugar on top of current Android view system, it doesn't even have diff algo
g
yep, the main goal (I hope) is not another syntax but immutable views, means virtual DOM + smart diffs. Basically, React.
s
@rook
👍 2
💯 1
g
@burak.eregar sorry mate, but other than "activity imitation" to promote someone's profile I can't really see the purpose of this "article". It's like forking repos in batch on GitHub before job application, to get green squares 😄. It's probably too early to write something meaningful about the subject, they even failed to make it work from the first try live on stage, lol.
b
Thanks for your feedback. My purpose is giving heads up to people who haven't watched the keynote, gathering all the information we have together and keep this post updated once we get more updates on it. As I said I am looking forward to listening the talk later today.
r
@sngrekov consider my mind blown. I had no idea.
t
Why they call () -> Unit functions "pure"? Why to use a mutable model with annotation? Why not to return a structure representing the desired ui and then do the reconcilation algorhythm on it?
2
l
@themishkun I’ve asked the same question in the #compose-wtf inside of Android Study Group. I wasn’t completely sold on their reasons, but here an image of it.
Screen Shot 2019-05-08 at 4.57.56 PM.png
👍 1
i
How does anyone able to get the custom Kotlin plugins?
p

https://www.youtube.com/watch?v=VsStyq4Lzxo

💯 1
t
@laimiux Oh, thanks for asking that! Can you also reach out to ask about what problem they are trying to solve using
@Model
annotation they shown in the talk above? It seems like it can add unnecessary complexity, unexpected behaviour and circular dependencies. We already have Delegates.observable, why to make a compiler plugin do exactly that?
2
g
asking the real questions... ☝️
r
Jetpack Compose does not create Views
👌 3
3
p
@romainguy But one view it needs if it wants to draw stuff. What kind of view is it? Is it a surfaceview? Where can I find the soruce for that view?
t
@romainguy Is there any dev's approved way to reach out with questions and feedback? Also is there anywhere a public roadmap for the project?
s
@Paul Woitaschek It draws on canvas
t
@romainguy If you partnered with JB on making this project live, have you seen this project on reconcilation algo then? https://github.com/JetBrains/noria-kt
p
@sngrekov you need a view to get a canvas
r
You don’t need really need a View to get a Canvas no
But currently we use a View as an anchor in the existing window and then it’s all Compose after that
It’s not a SurfaceView
And it doesn’t matter because it’s implementation details anyway, this might change based on the version of the platform (we may use multiple Views, attached or not, to benefit from render nodes/display lists, etc.)
@themishkun We’re trying to figure out what’s the best way to answer questions and feedback, stay tuned
t
#compose is the new channel