No video

How to Build an MVI Clean Code Weather App in Android Studio (Jetpack Compose)

  Рет қаралды 118,537

Philipp Lackner

Philipp Lackner

2 жыл бұрын

In this video, you'll learn how you can make use of the Open Meteo API to get weather data and nicely display it in an Android app.
Check the API here:
open-meteo.com/en
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become an industry-ready Android developer now with this course:
pl-coding.com/premium-courses...
Inspired by this design:
dribbble.com/shots/17998271-C...
Get the initial source code here:
github.com/philipplackner/Wea...
Get the final source code for this video here:
github.com/philipplackner/Wea...
Join my Discord server:
/ discord
Regular programming advice on my Instagram page: / _philipplackner_
Checkout my GitHub: github.com/philipplackner
You like my free content? Here you can buy me a coffee:
www.buymeacoffee.com/philippl...

Пікірлер: 139
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Little correction for 34:48, you'd actually also need to take care of the case when the time would be 23:50 for example, then you want to take 12am of the next day, not of the current one. Take it as a homework 😂
@devstuff2576
@devstuff2576 2 жыл бұрын
You are awesome. Thank you
@evgenyplaksin2380
@evgenyplaksin2380 2 жыл бұрын
i'm too lazy to do it)
@ahmedabdelrahman1375
@ahmedabdelrahman1375 Жыл бұрын
val hour = when { now.minute < 30 -> now.hour now.hour == 23 -> 12.00 else -> now.hour + 1 }
@wagnerarcieri
@wagnerarcieri Жыл бұрын
Hey man, there is someone making scams using your name, check the comments in this video
@mohamadrezamehrjou9553
@mohamadrezamehrjou9553 3 ай бұрын
val hour = if (now.minute >= 30) now.hour + 1 else now.hour
@MKRN_2024
@MKRN_2024 2 жыл бұрын
The app looks so powerful. Thank you for great videos as always.
@leonardosibela
@leonardosibela 2 жыл бұрын
Philip, today I'll starting doing a lot of your videos and learning Compose. I said this a lot of times here, but, man... You rock!! You are really awesome!! I've been seeing how you're growing as an youtuber. How your videos are getting better quality wise, how you are making funny stories, how you are taking about more hard topics such as SOLID, how you are using new stuff such as Compose... Anyway, you really have an awesome channel and I wish you all best!! You deserve to become a huge channel and I'm looking forward to see that :D
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thanks so much man🙏❤️
@sarahmohamed2973
@sarahmohamed2973 Жыл бұрын
I liked the idea of the app and your simple explanation for the concepts, thanks Philipp
@benkabore
@benkabore 7 ай бұрын
Wow really nice walk through. Thanks for taking it every step of the way.
@edycole5543
@edycole5543 2 жыл бұрын
thanks philipp, you are my teacher, more project with jetpack compose CRUD with room, restful api, and firebase, please, thanks
@user-eo9gb1qq7n
@user-eo9gb1qq7n 2 жыл бұрын
thank you for work Philipp, it's well done as always
@zacchariebouvy6719
@zacchariebouvy6719 2 жыл бұрын
Thanks for the good idea to use copy for the state ! This is what i was looking for.
@softcoder404
@softcoder404 2 жыл бұрын
currently searching for how to implement location service in jetpack compose and boom saw dis video .. Great video
@ZanluSk8
@ZanluSk8 Жыл бұрын
Hi Philipp, This tutorial is well made, as a general feedback it would be great if at the end of any video you would add some hints into how you would expand this app.
@animekingdom6919
@animekingdom6919 2 жыл бұрын
Thanks a lot for your amazing tutorials
@mirchm
@mirchm 2 жыл бұрын
Thank you for the tutorial ❤️
@dedeimansaputra5069
@dedeimansaputra5069 2 жыл бұрын
Nice tutorial, I'll test it right now!
@dipeshsaini04
@dipeshsaini04 2 жыл бұрын
Nice tutorial , its gives a great overview for how to use MVI architecture with Compose #Clean UI
@vivekagarwal1760
@vivekagarwal1760 Жыл бұрын
Thanks for the great tutorial!!!!
@AshishKumar-dy6sw
@AshishKumar-dy6sw Жыл бұрын
This really helped thanks a lot!
@JamesBond-mq7pd
@JamesBond-mq7pd 2 жыл бұрын
finally after two weeks finished this video.
@ankitverma3932
@ankitverma3932 2 жыл бұрын
Much needed!
@bhuvaneshwaranm7290
@bhuvaneshwaranm7290 2 жыл бұрын
Great tutorial!
@ericgacoki2225
@ericgacoki2225 2 жыл бұрын
That mapper logic was legendary 😅
@dev_jeongdaeri
@dev_jeongdaeri 2 жыл бұрын
Super cool!😎
@zynastor1
@zynastor1 Жыл бұрын
Thank you very much!
@hectorvector4887
@hectorvector4887 2 жыл бұрын
My best Android channel..
@sergeytarasov5041
@sergeytarasov5041 2 жыл бұрын
great, as usual !
@miladhashemzadeh5626
@miladhashemzadeh5626 2 жыл бұрын
Gr8 my friend thank you a lot
@samandar7632
@samandar7632 2 жыл бұрын
Wunderschön 😃
@hellosagar
@hellosagar 2 жыл бұрын
Philipp saying 30 degree HOT! meanwhile me chilling in 44 degrees 🥲
@pumaelgatosiberian5047
@pumaelgatosiberian5047 2 жыл бұрын
awesome, thanks
@hossamqandel5638
@hossamqandel5638 2 жыл бұрын
Hey man..in fact we are very lucky to have someone like you in the field of designing Android applications.. .you are a gift sent to us Can you explain how FCM deals with the API Request and also receiving a real notification from a chat application or something?
@samdroid37
@samdroid37 2 жыл бұрын
thank you! you rule!!!
@Tuannguyen-bn6sp
@Tuannguyen-bn6sp Жыл бұрын
lmao code in video is super easy to understand, it better than many project in github
@Alexeytrn
@Alexeytrn 2 жыл бұрын
Brilliant
@bajrangchapola6748
@bajrangchapola6748 2 жыл бұрын
Good content again!!!. Can you make a video on Firebase Authentication using MVVM clean architecture?
@bboitech8920
@bboitech8920 2 жыл бұрын
Great vid
@FrankGP.Mobile
@FrankGP.Mobile Жыл бұрын
excellent exercise
@OtarBediashvili
@OtarBediashvili 2 жыл бұрын
Wireless debugging works ok on Electric Eel but if you are using a cable, try a better quality one, even if the cable you're using now seems fine
@geekdev0
@geekdev0 2 жыл бұрын
Hi, thanks for the great tutorial. Will it be possible to make lessons on testing this application ?
@andriisolomonov7302
@andriisolomonov7302 Жыл бұрын
Hey, thanks for intro. I keep wanting to start using compose but keep staying with xml. Now thinking to start again, however now is a question, what are the recommendations now about all basic dependencies such as navigation.
@alex08585
@alex08585 Жыл бұрын
Hi @Philipp, the part for getting the location 47:07 in the code for "lastLocation" this shows an error I checked online and found lastLocation is deprecated, what is the alternative i can add in the code
@pauloCosteira
@pauloCosteira 2 жыл бұрын
Where u declarate your Intentions??? You have your WeatherState I think that you have a WhatherIntention for example: sealed class WhatherIntention{ object FetchData: MainInten() ... } and cosuming in your viewModelm and cosuming in your viewModel
@clamum9648
@clamum9648 2 жыл бұрын
Clean Architecture does seem interesting but agreed with what you said at start that it can be overkill for smaller apps like this (to include Use Cases, etc). I'm using it for rewriting an old Android app of mine and I'm not even half done and am actually considering starting over and dropping CA or at least neutering it, lmao. The app is so much more complicated now (using Kotlin/Room/Clean Arch, from just Java/Sqlite) and has at least 3-4 times the number of files as the old app and I'm not even half done yet. It's just a super simple mainly data entry and listview type app with a few screens.
@juanpablouriolbalbin887
@juanpablouriolbalbin887 Жыл бұрын
Hi Philpp! Why do you build a Resource class instead of using Kotlin's Result class? Thank you for the video
@emmanuelmtera5936
@emmanuelmtera5936 2 жыл бұрын
Hello Philip, nice video, can you do a video in compose concerning camerax and mlkit or tensorflow like face detection, enrollment e.t.c Thanks
@batya-im1sc
@batya-im1sc Жыл бұрын
Is it okay that we are using drawable dependency in domain layer WeatherType mode???
@ArthurKhazbs
@ArthurKhazbs 9 ай бұрын
"It would be cool to know how hot it actually is" - ha-ha, nice!
@Zeeshan-Syed
@Zeeshan-Syed Жыл бұрын
Hey Philipp, I thought I will see something new with MVC architecture but there is nothing difference compared to MVVM.. am i missing something or you accidentally mentioned MVC instead of MVVM
@nrg4285
@nrg4285 Жыл бұрын
What a bummer, followed and coded the entire way up to 1:16:16 and the app doesn't work, just tried the source code from master and that one doesn't work either, presumably due to the location code issue that someone else in the comments mentioned was deprecated...
@Matiplayer
@Matiplayer 2 жыл бұрын
Hey @Philipp Lackner, I watched this video to see how does MVI architecture look like and how does it differ from 'classic' MVVM, but i don't see any differences from other tutorial apps done with MVVM (besides the difference of not using UseCases here) Could You please clarify or explain what the actual difference is? (since I always assumed that MVI does not use ViewModels but some other classes to resolve UI state control)
@alexneeky7920
@alexneeky7920 2 жыл бұрын
same thing, this is not an MVI - no reducers, no stores, maaaybe a single state - WeatherState, but it looks like a MVVM + jetpack compose, which is great, but it's not what the title says - "MVI Clean Code Weather App"
@mark99999ish
@mark99999ish 2 жыл бұрын
Why MVI doesn't use ViewModels? ViewModel is just one type of controllers with longer lifcycler then fragment or activity. In the MVI architecture, we use an additional State and Event components, wich assumed us more flexible controll on the presentation layer
@SiamakAshrafi
@SiamakAshrafi Жыл бұрын
As stated. This is not MVI. No reducers, Channels, Immutable State and no Intents so how can it be MV(Intent)? If you try to explain why this is not MVVM+ you will realize it is MVVM+.
@xalikv
@xalikv 2 жыл бұрын
Hello Philipp !👋
@alonshlider4881
@alonshlider4881 2 жыл бұрын
Can you make a followup video on this one adding testing?
@TarunKumar-sq5wj
@TarunKumar-sq5wj 2 жыл бұрын
Is MVI better suited for Compose (seen many examples) or you just used it for a change since everyone uses MVVM all the time?
@LightBueno
@LightBueno Жыл бұрын
MVI - Model View Intent Could anyone explain to me what would be the Intent part here?
@fensom80
@fensom80 2 жыл бұрын
If I am using a graphql backend can I use retrofit or should I use Apollo. I don't really get Apollo. just struggling my way through learning Kotlin and Jetpack Compose and clean architecture. lol
@claytonmabatlo253
@claytonmabatlo253 Ай бұрын
Hi Philip, i hope you are good. Could you please explain how you generated this end-point v1/forecast?hourly=temperature_.............that went to the WeatherAPI
@simoneklinkon3663
@simoneklinkon3663 Жыл бұрын
Hi, In case I wanted to fix the position of the app in my town for wwxample, how I can do?
@nat.serrano
@nat.serrano Жыл бұрын
great tutorial, what theme and font are you using? I can follow without having any knowledge of kotlin but slowly, what course from your portfolio do you recommend me to buy? I'm coming from swift and I have kids so I have limited time to learn, I want to learn fast
@PhilippLackner
@PhilippLackner Жыл бұрын
Thanks! I'm using xcode dark and source code pro font. All my premium courses are a bit more advanced, but if you already watched and understood videos like these, the multi module course is a good start to get an understanding of Android architecture. Also if you have a swift background you might want to look at the kmm course which teaches how to build ios and Android apps mostly with kotlin (and a bit of swift 😄)
@sigjakutube
@sigjakutube Жыл бұрын
Could you quote a source for the pressure, humidity etc icons?
@romansemenyshyn6052
@romansemenyshyn6052 10 ай бұрын
Thanks for tutorial. But where is the internets? (You claimed MVI architecture) 😞
@sk-nath
@sk-nath Жыл бұрын
Can I published app on playstore using free weather api ? but it's mention non commercial use
@miltonpimentel3769
@miltonpimentel3769 2 жыл бұрын
Amazing video. Congrats. what yours themes in android studio???
@javieer
@javieer 2 жыл бұрын
Also want to know🙌
@damask_
@damask_ Жыл бұрын
hey, Philipp! I'd like to have the same skills to make such a good architecture, but it's difficult to me to figure out why creating so many classes, interfaces is needed could you advice me some materials, books to get comprehensive understanding of developing clean architecture apps? thank you in advance
@baderkhaneoussama
@baderkhaneoussama Жыл бұрын
try out Clean Architecture: A Craftsman's Guide to Software Structure and Design
@David-zb8br
@David-zb8br 2 жыл бұрын
can you explain why did you use mvi over mvvm for this specific project?
@sevbanthebuyer
@sevbanthebuyer 2 жыл бұрын
because our app does not depend on user interactions. İt's only a screen that show some values. So in MVI, we use a single state for each whole screen and it's easy to control cases with single State instead of many states for many ui elements.
@calvinkaranja1306
@calvinkaranja1306 Жыл бұрын
my app does load but upon giving location perms it moves to the next screen then crashes ... what could be the problem
@DaymnDotEth
@DaymnDotEth Жыл бұрын
5:05 Copying the Github code, cant select Initial from Master drop down.... not sure if thats why my set up isnt working when I add master.... Im just learning this so its probably something stupdi
@WansaIndika
@WansaIndika 8 ай бұрын
Moshi Converter will not throwing any errors for malform response, whta'ts your openiton about it, I would use Kotlin Json Convertor which not clean but usefull
@Daaab89
@Daaab89 Жыл бұрын
Me: "I will create a simple weather app to learn MVI + Compose, lets see what I can learn from KZfaq" KZfaq: "Here is a video on how to create a weather app with MVI + Compose"
@user-lb6rg5cr1t
@user-lb6rg5cr1t Жыл бұрын
hey @@PhilippLackner could you please show newer version of this video because new version of android comes with lots of dagger hilt issue
@victorsanchezmula1051
@victorsanchezmula1051 6 ай бұрын
great video ty
@elnatand
@elnatand 2 жыл бұрын
Why you named the class which wrap the API calls responses as "Resource" and not "Result"?
@nomugop8017
@nomugop8017 Жыл бұрын
So, MVI is just replacing xml with compose with States?
@romeobetances7964
@romeobetances7964 2 жыл бұрын
Let me ask you a question. Do you recommend to an android developer to learn SwiftUI?
@rohitsardana6805
@rohitsardana6805 2 жыл бұрын
3 times did not start, but then it worked
@tonnie7079
@tonnie7079 2 жыл бұрын
At 1:27:13 the app is working but I can't help to wonder why the sun on the emulator is shining at Midnight, which location is this or is it a bug
@Let_it_be
@Let_it_be 2 жыл бұрын
He takes icons from WeatherType. There are only daytime icons
@jasleenchahal8560
@jasleenchahal8560 3 ай бұрын
I have enabled gps and location permission on device still not able to display weather info
@claytonmabatlo253
@claytonmabatlo253 Ай бұрын
same here
@nikolozlatsabidze2196
@nikolozlatsabidze2196 2 жыл бұрын
instead of data class (weatherState) we can use seald class right?.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Nah, not for a screen ui state
@maksym6415
@maksym6415 2 жыл бұрын
If domain layer is innermost layer, where should we place useCases? They are the part of business logic, but not data.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
They belong to domain
@GeetainSaar
@GeetainSaar 17 күн бұрын
This year in India it was 50°C
@muhammadsarimmehdi
@muhammadsarimmehdi 2 жыл бұрын
will you create a multi-modular app tutorial in the future?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Got a full course already: pl-coding.com/multi-module-course
@muhammadsarimmehdi
@muhammadsarimmehdi 2 жыл бұрын
@@PhilippLackner any plans to make a free one?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
@@muhammadsarimmehdi no, that's a huge topic and requires some time to do right. Nothing for KZfaq
@shivanshgrover6101
@shivanshgrover6101 2 жыл бұрын
Do you have any Mac version?
@punyan775
@punyan775 7 ай бұрын
I tried running the app but it says " Couldn't retrieve location. Make sure to grant permission and enable GPS"
@claytonmabatlo253
@claytonmabatlo253 Ай бұрын
same issue
@frankyjunior6005
@frankyjunior6005 2 жыл бұрын
why in weather repository you return weatherinfo not weatherdto?, only later in use case we should mapping it to weatherinfo
@PhilippLackner
@PhilippLackner 2 жыл бұрын
No that's not correct. That way the use case would use a class from the data layer which would be against the principle of the domain layer
@frankyjunior6005
@frankyjunior6005 2 жыл бұрын
@@PhilippLackner but in your tutorial CryptocurrencyAppYT, in data package you just return the dto, then in usecase package you mapping to domain object. which one is correct?
@byran3019
@byran3019 2 жыл бұрын
Seems cannot get location when API level is 31 or higher.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
I'm using that API level
@alanprajapati8007
@alanprajapati8007 2 жыл бұрын
Yes, i am using API level 31 and location is not getting. I debug the code but there is no error showing. Please tell me if anyone knows the solution. Thanks!
@ahmedfouda45
@ahmedfouda45 Жыл бұрын
hey there! did you find any solution for that i'm using api level 33 and couldn't retrieve location
@asadqasim8234
@asadqasim8234 Жыл бұрын
Thank u so much. I've been so confused, but tNice tutorials video helped a lot.
@radenyaqien
@radenyaqien 2 жыл бұрын
so we doesnt need return flow when get api?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
nah why? It's just one result, not multiple
@radenyaqien
@radenyaqien 2 жыл бұрын
ok thanks
@anb4351
@anb4351 Жыл бұрын
I really appreciate your work, You have helped me tremendously in becoming a better developer but you have a problem, you tend to make thing unnecessarily complex. Things which could have been done / written in simpler more readable manner, you tend to make them complex
@josephzhou7035
@josephzhou7035 Жыл бұрын
Well i don't think so, the network objects here are not quite easy to work with and overall Philip processed it quite well.
@swish6143
@swish6143 11 ай бұрын
It says clean code in the title and is obviously intended for more complex apps, where it does make sense.
@siva_subramaniam
@siva_subramaniam Жыл бұрын
bm - 15:02 to 36:00
@RoKotEyn
@RoKotEyn Жыл бұрын
"REFRESH" button is needed in this app.
@wagnerarcieri
@wagnerarcieri 2 жыл бұрын
Hey man ! please set your starting codes on Github as TEMPLATES, so we can easily create a repository equals your
@dujemandalinic5468
@dujemandalinic5468 2 жыл бұрын
he leaves the starting code in description of every video man, here you go: Get the initial source code here: github.com/philipplackner/WeatherApp/tree/initial Get the final source code for this video here: github.com/philipplackner/WeatherApp
@wagnerarcieri
@wagnerarcieri 2 жыл бұрын
@@dujemandalinic5468 did you read my comment ? I was referring to the GitHub code you are mentioning... I was asking for him to set a configuration on the project that make it have a new button right side of "CLONE" in GitHub... a button "TEMPLATE"... when you click this template button, the GitHub copies the repository to your user with all files
@dujemandalinic5468
@dujemandalinic5468 2 жыл бұрын
@@wagnerarcieri I was too fast to write, should have read it once more. oops.
@seanthomas9398
@seanthomas9398 Жыл бұрын
No big deal alert, but the domain layer should also be free of Android dependencies. So the LocationTracker method shouldn't return an Android Location.
@ubersticks
@ubersticks Жыл бұрын
I am pretty sure he mentioned that specifically at: 41:17
@HugoElcabezas
@HugoElcabezas 2 жыл бұрын
any youtuber as good as this one but code on xcode with swift ?
@AhmadBakdash07
@AhmadBakdash07 2 жыл бұрын
Why are a lot of programmers from Germany? and why you don't have a german speaking channel? how you learned programming in Germany? ...last question... if I am in Germany and can do some programming, what to do to continue to be a professional programmer?
@josipmarasovic2436
@josipmarasovic2436 Жыл бұрын
use english mate come on
@Steve-sm2mw
@Steve-sm2mw Жыл бұрын
Andoird development is over-complicated. I would expect an API call takes one line of code, but it doesn't looks like that.
@justmeagain9302
@justmeagain9302 Ай бұрын
How do you actually do it in other platform?
@Steve-sm2mw
@Steve-sm2mw Ай бұрын
@@justmeagain9302 Alamofire for iOS and OkHttpClient for Android. Those are my choices after years of mobile development. Android development itself isn't that complicated if you get the concept/framework/template. This youtuber did the simple API call in the hard way.
@DaleKingProfile
@DaleKingProfile Жыл бұрын
WeatherType violates clean architecture. It is spanning data, domain, and presentation. It knows about the codes from this particular API (data layer) and it contains references to icons (presentation). If you switched to a different service that did not use the same codes that would mean changing domain layer. If you changed the icons used to present the weather type that would also mean changing the domain layer. The weather type in domain should just be an enum or sealed class hierarchy. It should know nothing about codes or icons. The mapping from code should be a function in the data layer that takes a code and returns a weather type. Similarly mapping type to an icon would be a function in presentation.
@roonyshekho8067
@roonyshekho8067 2 жыл бұрын
It's 42 in Iraq 🥵🥵
@ksmakan
@ksmakan Жыл бұрын
The Hilt compiler is not able to find a way to provide an instance of the DefaultLocationTracker class. This class is a concrete class, so it does not have an @Inject constructor. revised code snippet: class DefaultLocationTracker @Inject constructor( private val locationClient: FusedLocationProviderClient, private val application: Application ) : LocationTracker {..}
@mehmettekin9142
@mehmettekin9142 2 жыл бұрын
Thanks Philipp . Guys If you get the following error about "Dagger Hilt" becuase of this "implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"" you have to delete it . ERROR : ComponentProcessingStep was unable to process 'com.mehmettekin.shortweatherapp.WeatherApp_HiltComponents.SingletonC' dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved
@amirdorri888
@amirdorri888 5 ай бұрын
thanks a lot. Im in Iran, there's a problem for me when i run the app it says couldn't retrieve the location and in logcat "RKPD failed to provision keyscom.android.rkpdapp.RkpdException: HTTP error status encountered: 400"
5 Fatal Coroutine Mistakes Nobody Tells You About
18:15
Philipp Lackner
Рет қаралды 86 М.
Should You Use Compose State or StateFlow in Your ViewModels?
13:59
Philipp Lackner
Рет қаралды 74 М.
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 2,3 МЛН
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 8 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 5 МЛН
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 36 М.
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 11 М.
What Is the Best Architecture for Android Apps?
17:57
Philipp Lackner
Рет қаралды 56 М.
MVI в Android на практике
19:20
Тимофей Коваленко
Рет қаралды 15 М.
Want to build a good API? Here's 5 Tips for API Design.
10:57
CodeOpinion
Рет қаралды 201 М.
6 Design Patterns Every Android Developer Must Know
14:16
Philipp Lackner
Рет қаралды 79 М.
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 2,3 МЛН