Let's Migrate an XML Project to Jetpack Compose!

  Рет қаралды 27,001

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 42
@PhilippLackner
@PhilippLackner 2 жыл бұрын
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.
@halvtysk
@halvtysk 2 жыл бұрын
I was just about to ask about these details, as this was the thing that was the most time-consuming for me when I started migration. Understanding how to setup typography-classes took some time, and, to be honest, I'm still not sure if I'm handling theme:ing the correct way, or if I'm simply relying on colorResources, etc too much. These details (from a migrating perspective as opposed to a "start from scratch"-approach) would be interesting to see your take on.
@saurabhyadav-sz9rx
@saurabhyadav-sz9rx 2 жыл бұрын
In my firm, we are now migrating our code from XML to Compose. This video is really helpful. Kudos!
@Camlon
@Camlon 2 жыл бұрын
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.
@aokruan
@aokruan 2 жыл бұрын
Thank you for this video. The most important information.
@pumaelgatosiberian5047
@pumaelgatosiberian5047 2 жыл бұрын
Hi Philipp, why you use lateinit var compose view? you can do like that View = ComposeView(requireContext()).apply { setContent {} } in onCreateView
@mariumbegum7325
@mariumbegum7325 2 жыл бұрын
Great to see an insightful tutorial
@xCrawfly
@xCrawfly 7 ай бұрын
This is the only video tutorial from the jetpack compose series that I couldn't finish :( I got tons of gradle errors just at the last step, I assume it's because the dependencies versions have changed (even tho I replaced those by the more recents). I think I'll just try it with a newer video tut. Anyway, Thanks Philipp!
@benchakalaka
@benchakalaka 2 жыл бұрын
Extremely useful! Thank you
@SachinKumar-nb3pg
@SachinKumar-nb3pg 2 жыл бұрын
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.
@chrislagos44
@chrislagos44 3 ай бұрын
Ok how can i compare the lioading time and performance of my xml views before and after migration
@azamat0180
@azamat0180 2 жыл бұрын
could u please make tutorial about baseline profiles?))
@greenvoice28
@greenvoice28 2 жыл бұрын
Thanks Philipp!
@2chotti
@2chotti 3 ай бұрын
Thank you
@nomugop8017
@nomugop8017 2 жыл бұрын
excellent, as always
@nipunkumarit2168
@nipunkumarit2168 2 жыл бұрын
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.
@asadullahilyas
@asadullahilyas 2 жыл бұрын
Create a Composable function, with a click callback. In that composable, create a button. On clicking that button, play the specific sound and after that, call your callback that you passed in this composable function.
@nipunkumarit2168
@nipunkumarit2168 2 жыл бұрын
@@asadullahilyas cool
@user-dealcart
@user-dealcart Жыл бұрын
@Philipp can you help me understand this XML code?
@mustafaammar551
@mustafaammar551 2 жыл бұрын
you are the best👌👌
@ИльяШелковенко
@ИльяШелковенко 2 жыл бұрын
Hi Philipp, thank you for your content. Can you tell, what theme exactly do you use in your android studio?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Xcode dark
@samstoyroom
@samstoyroom 2 жыл бұрын
Can you make a video about how to handle Lifecycle event in compose? Thanks!
@AhmedAli-ld6en
@AhmedAli-ld6en 2 жыл бұрын
Perfect As Always
@PandaTop.
@PandaTop. 2 жыл бұрын
What kind of theme do you have in Android Studio? P.S. Thank you!
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Xcode dark
@daniyar2718
@daniyar2718 2 жыл бұрын
Thanks 👍
@2chotti
@2chotti 3 ай бұрын
Briliant
@maximooze3196
@maximooze3196 2 жыл бұрын
Another Like from me, even though I dont need this, because Im a "guru". 🤣 jk @Philipp, another good content!
@Rohan_is_discovering
@Rohan_is_discovering Жыл бұрын
can I convert my whole JAVA android project to jetpack compose..?
@PhilippLackner
@PhilippLackner Жыл бұрын
By completely rewriting it in Kotlin
@aymenebenguedouad3180
@aymenebenguedouad3180 2 жыл бұрын
Can you give us sources to learn Android compose
@josua_htp
@josua_htp 2 жыл бұрын
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 🙏
@sebastianseno9285
@sebastianseno9285 2 жыл бұрын
it's still painful to see UI preview in compose.
@coffeedude
@coffeedude 2 жыл бұрын
Yep
@sebastianseno9285
@sebastianseno9285 2 жыл бұрын
@@coffeedude I hope they added hot reload flutter like in compose
@nijuyonkadesu
@nijuyonkadesu 2 жыл бұрын
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
@atikurrahamanshakur8138
@atikurrahamanshakur8138 2 жыл бұрын
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?
@Ericblessedchild
@Ericblessedchild 2 жыл бұрын
I didn't like flutter too at first , however it's more simple than using XML , optimised flutter UI is way faster than XML , easily reusable and also has minimal lags while building large scale apps, In terms of hardware access I don't like flutter .
@nijuyonkadesu
@nijuyonkadesu 2 жыл бұрын
I'm only irritated when dealing with edge cases, it reminds me of CSS a bit,.. or like while I think something and when put them as code, output would be different.. then go back and edit
@alokeshnath4269
@alokeshnath4269 2 жыл бұрын
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...🙏🙏
Should You Use Compose State or StateFlow in Your ViewModels?
13:59
Philipp Lackner
Рет қаралды 83 М.
Full Guide to Jetpack Compose Effect Handlers
24:56
Philipp Lackner
Рет қаралды 99 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
How to Validate Forms with Clean Architecture (You're Doing it Wrong)
41:08
The ULTIMATE Guide to Sharing Data Between Screens in Jetpack Compose
24:08
Full Guide to Delegation in Kotlin  - Android Studio Tutorial
18:10
Philipp Lackner
Рет қаралды 72 М.
How to Draw On a Canvas In Jetpack Compose - Android Studio Tutorial
31:47
Basics and Widgets | Flutter - Zero to Hero | Part 1
45:47
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
Advanced Kotlin: Mastering Delegation in Kotlin
18:54
kt whisperer
Рет қаралды 9 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН