https://kotlinlang.org logo
#compose
Title
# compose
g

Grigorii Yurkov

10/31/2019, 6:19 PM
In noble future when compose is released, activities, fragments, views will be annotated with
@Deprecated
?
👍 1
🚫 1
😆 3
f

Fudge

10/31/2019, 6:21 PM
I think those things will be treated like Java. While we all feel Java is deprecated, people can still use it because that’s what they know/have/like.
l

Luca Nicoletti

10/31/2019, 6:28 PM
And
@Composable
could be used with
@GenerateView
(which is not implemented yet) to generate a
View
subclass which you then can use in your
.xml
file
So I don’t think they will deprecated core components of Android
m

Michal Bacik

10/31/2019, 6:30 PM
I can't imagine that Activity will be deprecated, if new UI shall work on old devices with existing framework. Activity is one thing that probably can't be replaced. It's base thing that works with Window, needed for UI.
f

Fudge

10/31/2019, 6:31 PM
Compose doesn’t use activities afaik
👌 1
l

Luca Nicoletti

10/31/2019, 6:31 PM
Well, in
Compose
the
Activity
is used as a starting point for
setContent
, but
setContent
itself doesn’t use the
Activity
, as you said it used
Window
So, if you can provide the
Window
without using the
Activity
the
Activity
could become not necessary anymore
m

Michal Bacik

10/31/2019, 6:33 PM
And this is I think not possible. Android won't show Window for an app without Activity. Also, does compose offer lifecycle events that we know from Activity: onResume, onStart, onCreate, etc?
l

Luca Nicoletti

10/31/2019, 6:34 PM
No, it has its own lifecycle callbacks
onCommit
,
onActive
,
onDispose
@Michal Bacik maybe the
Application
can provide the
Window
🙂
g

Grigorii Yurkov

10/31/2019, 6:36 PM
I understand that activity is base element in android. I mean that we will not use activity directly.
It will be under compose hood
l

Luca Nicoletti

10/31/2019, 6:37 PM
hmm, I don’t think so 🙂 read the link I posted above
p

Pablichjenkov

10/31/2019, 6:46 PM
It is always convenient to have an entry point for system events. At the end, an Activity is a common sink from some sensors and configuration changes. So leaving it wouldn't hurt. Now Fragments, they are strong candidates to be outs. In fact they are already out.
m

Michal Bacik

10/31/2019, 6:47 PM
Also note that Compose will allow to be integrated gradually - maybe only for some views, or for all UI in existing Activity which will still use activity lifecycle. It's not expected that we'll rewrite apps completely just because compose arrives.
👍 2
p

Pablichjenkov

10/31/2019, 6:53 PM
It should. I hope one day Android adopts kind of a micro-service oriented strategy, where inserting a new service don't need to touch existing ones. As of now, every Google IO, Android Summit has become basically a nightmare for devs. After the event you just realize how much code you have to migrate. 🧌
a

Adam Powell

10/31/2019, 9:03 PM
The
Activity
will still exist, the idea behind expressing one as a single
@Composable
function with some additional annotation is indeed that you would not manually write an
Activity
subclass and we would treat it as abstracted boilerplate.
💯 2
2 Views