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

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 138

  • @PhilippLackner
    @PhilippLackner  2 года назад +44

    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 😂

    • @evgenyplaksin2380
      @evgenyplaksin2380 2 года назад +2

      i'm too lazy to do it)

    • @ahmedabdelrahman1375
      @ahmedabdelrahman1375 2 года назад +3

      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 7 месяцев назад

      val hour = if (now.minute >= 30) now.hour + 1 else now.hour

  • @edycole5543
    @edycole5543 2 года назад +19

    thanks philipp, you are my teacher, more project with jetpack compose CRUD with room, restful api, and firebase, please, thanks

  • @leonardosibela
    @leonardosibela 2 года назад +15

    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

  • @softcoder404
    @softcoder404 2 года назад +3

    currently searching for how to implement location service in jetpack compose and boom saw dis video .. Great video

  • @OtarBediashvili
    @OtarBediashvili 2 года назад +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

  • @MKRN_2024
    @MKRN_2024 2 года назад +4

    The app looks so powerful. Thank you for great videos as always.

  • @JamesBond-mq7pd
    @JamesBond-mq7pd 2 года назад +2

    finally after two weeks finished this video.

  • @Matiplayer
    @Matiplayer 2 года назад +13

    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 года назад +5

      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 2 года назад

      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+.

  • @ericgacoki2225
    @ericgacoki2225 2 года назад +1

    That mapper logic was legendary 😅

  • @alex08585
    @alex08585 2 года назад +2

    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 года назад +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

  • @hectorvector4887
    @hectorvector4887 2 года назад

    My best Android channel..

  • @hossamqandel5638
    @hossamqandel5638 2 года назад +8

    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?

  • @sarahmohamed2973
    @sarahmohamed2973 Год назад

    I liked the idea of the app and your simple explanation for the concepts, thanks Philipp

  • @benkabore
    @benkabore 10 месяцев назад

    Wow really nice walk through. Thanks for taking it every step of the way.

  • @ZanluSk8
    @ZanluSk8 Год назад +1

    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.

  • @Zeeshan-Syed
    @Zeeshan-Syed Год назад +2

    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

  • @TarunKumar-sq5wj
    @TarunKumar-sq5wj 2 года назад +14

    Is MVI better suited for Compose (seen many examples) or you just used it for a change since everyone uses MVVM all the time?

  • @batya-im1sc
    @batya-im1sc Год назад +2

    Is it okay that we are using drawable dependency in domain layer WeatherType mode???

  • @claytonmabatlo253
    @claytonmabatlo253 5 месяцев назад

    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

  • @zacchariebouvy6719
    @zacchariebouvy6719 2 года назад

    Thanks for the good idea to use copy for the state ! This is what i was looking for.

  • @animekingdom6919
    @animekingdom6919 2 года назад +3

    Thanks a lot for your amazing tutorials

  • @Tuannguyen-bn6sp
    @Tuannguyen-bn6sp Год назад

    lmao code in video is super easy to understand, it better than many project in github

  • @hellosagar
    @hellosagar 2 года назад +1

    Philipp saying 30 degree HOT! meanwhile me chilling in 44 degrees 🥲

  • @juanpablouriolbalbin887
    @juanpablouriolbalbin887 Год назад +1

    Hi Philpp! Why do you build a Resource class instead of using Kotlin's Result class? Thank you for the video

  • @nrg4285
    @nrg4285 2 года назад +4

    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...

  • @RutvikNabhoya
    @RutvikNabhoya Год назад +1

    hey @@PhilippLackner could you please show newer version of this video because new version of android comes with lots of dagger hilt issue

  • @dedeimansaputra5069
    @dedeimansaputra5069 2 года назад +1

    Nice tutorial, I'll test it right now!

  • @ИльяШелковенко
    @ИльяШелковенко 2 года назад

    thank you for work Philipp, it's well done as always

  • @romansemenyshyn6052
    @romansemenyshyn6052 Год назад

    Thanks for tutorial. But where is the internets? (You claimed MVI architecture) 😞

  • @clamum9648
    @clamum9648 2 года назад +9

    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.

  • @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.

  • @David-zb8br
    @David-zb8br 2 года назад +2

    can you explain why did you use mvi over mvvm for this specific project?

    • @sevbanthebuyer
      @sevbanthebuyer 2 года назад +1

      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.

  • @dev_jeongdaeri
    @dev_jeongdaeri 2 года назад +2

    Super cool!😎

  • @sk-nath
    @sk-nath Год назад +1

    Can I published app on playstore using free weather api ? but it's mention non commercial use

  • @damask_
    @damask_ Год назад +2

    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

  • @ArthurKhazbs
    @ArthurKhazbs Год назад

    "It would be cool to know how hot it actually is" - ha-ha, nice!

  • @bajrangchapola6748
    @bajrangchapola6748 2 года назад +1

    Good content again!!!. Can you make a video on Firebase Authentication using MVVM clean architecture?

  • @LightBueno
    @LightBueno Год назад +1

    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

  • @tonnie7079
    @tonnie7079 2 года назад +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

  • @calvinkaranja1306
    @calvinkaranja1306 2 года назад

    my app does load but upon giving location perms it moves to the next screen then crashes ... what could be the problem

  • @dipeshsaini04
    @dipeshsaini04 2 года назад

    Nice tutorial , its gives a great overview for how to use MVI architecture with Compose #Clean UI

  • @punyan775
    @punyan775 10 месяцев назад +1

    I tried running the app but it says " Couldn't retrieve location. Make sure to grant permission and enable GPS"

  • @jasleenchahal8560
    @jasleenchahal8560 7 месяцев назад +1

    I have enabled gps and location permission on device still not able to display weather info

  • @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

  • @AshishKumar-dy6sw
    @AshishKumar-dy6sw 2 года назад +1

    This really helped thanks a lot!

  • @simoneklinkon3663
    @simoneklinkon3663 Год назад

    Hi, In case I wanted to fix the position of the app in my town for wwxample, how I can do?

  • @alonshlider4881
    @alonshlider4881 2 года назад

    Can you make a followup video on this one adding testing?

  • @elnatand
    @elnatand 2 года назад

    Why you named the class which wrap the API calls responses as "Resource" and not "Result"?

  • @mirchm
    @mirchm 2 года назад +1

    Thank you for the tutorial ❤️

  • @Daaab89
    @Daaab89 Год назад +1

    Me: "I will create a simple weather app to learn MVI + Compose, lets see what I can learn from RUclips"
    RUclips: "Here is a video on how to create a weather app with MVI + Compose"

  • @WansaIndika
    @WansaIndika Год назад

    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

  • @nomugop8017
    @nomugop8017 2 года назад

    So, MVI is just replacing xml with compose with States?

  • @zynastor1
    @zynastor1 Год назад +1

    Thank you very much!

  • @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  Год назад +1

      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 😄)

  • @miltonpimentel3769
    @miltonpimentel3769 2 года назад +1

    Amazing video. Congrats. what yours themes in android studio???

    • @javieer
      @javieer 2 года назад

      Also want to know🙌

  • @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

  • @geekdev0
    @geekdev0 2 года назад

    Hi, thanks for the great tutorial.
    Will it be possible to make lessons on testing this application ?

  • @romeobetances7964
    @romeobetances7964 2 года назад

    Let me ask you a question. Do you recommend to an android developer to learn SwiftUI?

  • @vivekagarwal1760
    @vivekagarwal1760 Год назад

    Thanks for the great tutorial!!!!

  • @mehmettekin9142
    @mehmettekin9142 2 года назад +1

    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

  • @ankitverma3932
    @ankitverma3932 2 года назад +1

    Much needed!

  • @miladhashemzadeh5626
    @miladhashemzadeh5626 2 года назад +1

    Gr8 my friend thank you a lot

  • @sigjakutube
    @sigjakutube 2 года назад

    Could you quote a source for the pressure, humidity etc icons?

  • @byran3019
    @byran3019 2 года назад +2

    Seems cannot get location when API level is 31 or higher.

    • @PhilippLackner
      @PhilippLackner  2 года назад

      I'm using that API level

    • @alanprajapati8007
      @alanprajapati8007 2 года назад +1

      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 2 года назад

      hey there! did you find any solution for that i'm using api level 33 and couldn't retrieve location

  • @seanthomas9398
    @seanthomas9398 2 года назад +1

    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

  • @muhammadsarimmehdi
    @muhammadsarimmehdi 2 года назад +1

    will you create a multi-modular app tutorial in the future?

    • @PhilippLackner
      @PhilippLackner  2 года назад +1

      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 года назад +2

      @@muhammadsarimmehdi no, that's a huge topic and requires some time to do right. Nothing for RUclips

  • @rohitsardana6805
    @rohitsardana6805 2 года назад

    3 times did not start, but then it worked

  • @maksym6415
    @maksym6415 2 года назад

    If domain layer is innermost layer, where should we place useCases?
    They are the part of business logic, but not data.

  • @xalikv
    @xalikv 2 года назад

    Hello Philipp !👋

  • @andreypoltev
    @andreypoltev Год назад

    "REFRESH" button is needed in this app.

  • @bhuvaneshwaranm7290
    @bhuvaneshwaranm7290 2 года назад +1

    Great tutorial!

  • @anb4351
    @anb4351 Год назад +2

    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 Год назад +1

      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 Год назад

      It says clean code in the title and is obviously intended for more complex apps, where it does make sense.

  • @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 {..}

  • @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 года назад +1

      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?

  • @samandar7632
    @samandar7632 2 года назад +1

    Wunderschön 😃

  • @nikolozlatsabidze2196
    @nikolozlatsabidze2196 2 года назад

    instead of data class (weatherState) we can use seald class right?.

  • @samdroid37
    @samdroid37 2 года назад

    thank you! you rule!!!

  • @FrankGP.Mobile
    @FrankGP.Mobile Год назад

    excellent exercise

  • @pumaelgatosiberian5047
    @pumaelgatosiberian5047 2 года назад

    awesome, thanks

  • @asadqasim8234
    @asadqasim8234 2 года назад +1

    Thank u so much. I've been so confused, but tNice tutorials video helped a lot.

  • @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.

  • @GeetainSaar
    @GeetainSaar 4 месяца назад

    This year in India it was 50°C

  • @sergeytarasov5041
    @sergeytarasov5041 2 года назад

    great, as usual !

  • @shivanshgr
    @shivanshgr 2 года назад

    Do you have any Mac version?

  • @santri.awon1
    @santri.awon1 2 года назад

    so we doesnt need return flow when get api?

  • @HugoElcabezas
    @HugoElcabezas 2 года назад +1

    any youtuber as good as this one but code on xcode with swift ?

  • @amirdorri888
    @amirdorri888 9 месяцев назад

    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"

  • @AhmadBakdash07
    @AhmadBakdash07 2 года назад +1

    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?

  • @siva_subramaniam
    @siva_subramaniam Год назад

    bm - 15:02 to 36:00

  • @bboitech8920
    @bboitech8920 2 года назад

    Great vid

  • @Steve-sm2mw
    @Steve-sm2mw Год назад +4

    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 5 месяцев назад +1

      How do you actually do it in other platform?

    • @Steve-sm2mw
      @Steve-sm2mw 5 месяцев назад

      @@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.

  • @victorsanchezmula1051
    @victorsanchezmula1051 9 месяцев назад

    great video ty

  • @DaleKingProfile
    @DaleKingProfile 2 года назад +1

    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.

  • @Its_nirbhay_gupta_
    @Its_nirbhay_gupta_ 23 дня назад

    You cannot watch this video at 2x 😭

  • @roonyshekho8067
    @roonyshekho8067 2 года назад

    It's 42 in Iraq 🥵🥵