https://kotlinlang.org logo
#android
Title
# android
b

burak.eregar

05/08/2019, 2:58 PM
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

Paul Woitaschek

05/08/2019, 3:32 PM
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

rook

05/08/2019, 3:38 PM
@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

burak.eregar

05/08/2019, 3:39 PM
I am looking forward to listening "Declarative UI patterns with Android Jetpack" talk today which will give us more context.
4
s

sngrekov

05/08/2019, 3:54 PM
@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

rook

05/08/2019, 3:59 PM
@sngrekov Interesting. Can you link me to the source files where it shows that Compose does not generate View classes?
p

Paul Woitaschek

05/08/2019, 4:00 PM
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

rook

05/08/2019, 4:06 PM
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

Paul Woitaschek

05/08/2019, 4:09 PM
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

nickk

05/08/2019, 4:24 PM
Why not adopt and enhance anko ?
s

sngrekov

05/08/2019, 4:54 PM
Anko is basically is syntax sugar on top of current Android view system, it doesn't even have diff algo
g

ghedeon

05/08/2019, 4:55 PM
yep, the main goal (I hope) is not another syntax but immutable views, means virtual DOM + smart diffs. Basically, React.
s

sngrekov

05/08/2019, 4:56 PM
@rook
👍 2
💯 1
g

ghedeon

05/08/2019, 5:07 PM
@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

burak.eregar

05/08/2019, 5:55 PM
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

rook

05/08/2019, 5:58 PM
@sngrekov consider my mind blown. I had no idea.
t

themishkun

05/08/2019, 11:01 PM
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

laimiux

05/08/2019, 11:58 PM
@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

itnoles

05/09/2019, 1:04 AM
How does anyone able to get the custom Kotlin plugins?
p

Paul Woitaschek

05/09/2019, 4:56 AM

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

💯 1
t

themishkun

05/09/2019, 7:09 AM
@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

ghedeon

05/09/2019, 10:03 AM
asking the real questions... ☝️
r

romainguy

05/10/2019, 9:56 PM
Jetpack Compose does not create Views
👌 3
3
p

Paul Woitaschek

05/11/2019, 5:08 AM
@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

themishkun

05/11/2019, 9:08 AM
@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

sngrekov

05/11/2019, 9:23 AM
@Paul Woitaschek It draws on canvas
t

themishkun

05/11/2019, 9:36 AM
@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

Paul Woitaschek

05/11/2019, 12:40 PM
@sngrekov you need a view to get a canvas
r

romainguy

05/11/2019, 7:06 PM
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

themishkun

05/12/2019, 5:14 PM
#compose is the new channel