Let's Migrate an XML Project to Jetpack Compose!

Let's Migrate an XML Project to Jetpack Compose!

Philipp Lackner

1 год назад

23,740 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@PhilippLackner
@PhilippLackner - 26.10.2022 12:40

As a little addition, in case you also want to migrate your XML theme to Compose:
1. All you really need to do for that is to create the theme-specific Compose files you already get in any new Compose project (Type.kt, Shapes.kt, Colors.kt, Theme.kt). You can just copy these over and adjust based on your theme.
2. Then, in every ComposeView in your project, you use YourAppTheme { ... } as the root wrapper.

That's it.

Ответить
@user-dealcart
@user-dealcart - 24.10.2023 14:47

@Philipp can you help me understand this XML code?

Ответить
@Rohan_is_discovering
@Rohan_is_discovering - 07.03.2023 20:54

can I convert my whole JAVA android project to jetpack compose..?

Ответить
@saurabhyadav-sz9rx
@saurabhyadav-sz9rx - 15.12.2022 14:20

In my firm, we are now migrating our code from XML to Compose. This video is really helpful. Kudos!

Ответить
@mariumbegum7325
@mariumbegum7325 - 11.11.2022 19:44

Great to see an insightful tutorial

Ответить
@user-eo9gb1qq7n
@user-eo9gb1qq7n - 29.10.2022 23:13

Hi Philipp, thank you for your content. Can you tell, what theme exactly do you use in your android studio?

Ответить
@aymenebenguedouad3180
@aymenebenguedouad3180 - 29.10.2022 14:29

Can you give us sources to learn Android compose

Ответить
@nijuyonkadesu
@nijuyonkadesu - 29.10.2022 08:39

XML to Compose Migration:

1. 𝙵𝚛𝚊𝚐𝚖𝚎𝚗𝚝𝙵𝚒𝚛𝚜𝚝.𝚡𝚖𝚕's equivalent is 𝙵𝚒𝚛𝚜𝚝𝚂𝚌𝚛𝚎𝚎𝚗.𝚔𝚝
2. Define UI using composable along with state, viewmodel / action, onClick function
3. Set up compose view in fragment, define onclick fns, observe viewModel, pass it to composable

Ответить
@alokeshnath4269
@alokeshnath4269 - 27.10.2022 20:08

Hey Philipp Please help me or anyone who know the answer;
I have got this error in google internal testing "" Error in java.lang.AbstractMethodError: abstract method "void androidx.test.internal.platform.ThreadChecker.checkNotMainThread() ""
I have search all over the internet but didn't get the solution please help me...🙏🙏

Ответить
@aokruan
@aokruan - 27.10.2022 18:57

Thank you for this video. The most important information.

Ответить
@samstoyroom
@samstoyroom - 27.10.2022 16:31

Can you make a video about how to handle Lifecycle event in compose? Thanks!

Ответить
@AhmedAli-ld6en
@AhmedAli-ld6en - 27.10.2022 15:28

Perfect As Always <3

Ответить
@pumaelgatosiberian5047
@pumaelgatosiberian5047 - 27.10.2022 09:12

Hi Philipp, why you use lateinit var compose view? you can do like that View = ComposeView(requireContext()).apply { setContent {} } in onCreateView

Ответить
@Camlon
@Camlon - 27.10.2022 08:27

Thanks for the video. I have been working with migrating XML to compose views for some time, and I prefer to pass the findNavContoller() function to the composable. Then I can create a channel that will be consumed by a shared composable.

That means no callback functions to the fragment, it looks more similar to a pure compose screen and just a single line for each screen to allow navigation, toast, pop with arguments, etc.

Also, a simple way to add all compose dependencies is to right-click on the project and tap New -> Compose -> Empty Compose Activity.

Ответить
@josua_htp
@josua_htp - 27.10.2022 08:17

hi philipp, thanks for your tutorial videos because it really helps! if i may ask you one thing, please create one video on how to learn programming really fast. a short video is good too. thank you 🙏

Ответить
@daniyar2718
@daniyar2718 - 27.10.2022 00:05

Thanks 👍

Ответить
@atikurrahamanshakur8138
@atikurrahamanshakur8138 - 26.10.2022 22:11

I really don't like this declarative approach of building UI. When flutter came out with this approach I was really exited. But really didn't like it. I tried flutter multiple times but didn't really like it. Same thing is happening with compose. Anyone else can relate?

Ответить
@mustafaammar551
@mustafaammar551 - 26.10.2022 21:43

you are the best👌👌

Ответить
@nomugop8017
@nomugop8017 - 26.10.2022 18:25

excellent, as always

Ответить
@nipunkumarit2168
@nipunkumarit2168 - 26.10.2022 16:49

I have a silly point but I think it's important, When you have to apply a sound on every button clicked in your app, what should the best approach to this.

Ответить
@sebastianseno9285
@sebastianseno9285 - 26.10.2022 16:06

it's still painful to see UI preview in compose.

Ответить
@benchakalaka
@benchakalaka - 26.10.2022 15:49

Extremely useful! Thank you

Ответить
@SachinKumar-nb3pg
@SachinKumar-nb3pg - 26.10.2022 15:40

Hey Philipp, Thank you so much for this great video. But you forgot to add composeView.setViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed) inside the fragment which helps composeView to dispose its's composition when the view's lifecycleowner is destroyed.

Ответить
@SimpleBattleSimulator
@SimpleBattleSimulator - 26.10.2022 15:17

What kind of theme do you have in Android Studio?
P.S. Thank you!

Ответить
@maximooze3196
@maximooze3196 - 26.10.2022 14:57

Another Like from me, even though I dont need this, because Im a "guru". 🤣 jk @Philipp, another good content!

Ответить
@azamat0180
@azamat0180 - 26.10.2022 14:26

could u please make tutorial about baseline profiles?))

Ответить
@greenvoice28
@greenvoice28 - 26.10.2022 14:09

Thanks Philipp!

Ответить