Hey everyone welcome back to new video and in this video we are going to create and search recipe app so in this app we are going to use some of the latest and greatest tool in Android development so we're going to talk about one by one what are the things I will use in order to create this project so first is modelization so basically this IP is a multimodular project and if you talk about modelization we are having three Different ways to achieve this the first way of achieving modelization is feature wise modelization second one
is layer wise modelization in which we are having three layers data domain and presentation and third approach is basically the combination of these two so for this project I'm going to use the third approach which is the combination of feature wise modelization and layer wise modelization so basically we are having a feature that contains three Layers data domain and presentation so if you talk about navigation navigation is difficult in multimodel projects so if you want to perform navigation you can perform the navigation by connecting your module with another module but the thing is ultimately in
future you are going to end up with c C dependency problem so in this video I'm going to tell you what is the best approach to perform your navigation by avoiding this circular dependency problem so I'm going To use here dagger Hilt so dagger Hilt is a third party library that is used to perform the dependency injection in your project so I'm going to use that if you're talking about our user interface so for the UI I will use jetpack compost because right now every project is nearly built up with jetpack compost so do to
this reason we have a one feature in which we are going to save our RSP in our local database so in order to to achieve this particular feature we're Going to use your room database casing so for this particular feature we're going to create an app database and within that app database we're going to save our recipe so we will see where is the best place to put our app database where is the best place to write our data access object and access our data access object with the help of AD database so we're going
to see everything in this particular video and apart from this we are having one Feature in which user can go and watch the recipe video so for for that I will create a separate module and this module is called media player module and I'm going to use third party Library which ultimately use to play the YouTube video so we're going to see what is the project that we're going to create here so first screen is basically a search screen in which you can type your uh based on that you will you are going to see
the recipe list and if you click any Of them you are going to see the recipe details and the top of your app bar you're going to see two different icon buttons that is used to save and delete that particular recipe item within your local database and when you scroll down to the bottom of this ree detail where you can find out a text which says watch YouTube video and if you click onto that text you will ultimately navigate to Media Player module where you can see the video and when you come back to your
Search screen in Floating Action button if you click on it you are going to see the saved re piece that is present in our app database and within that we are having sorting logic so you can sort this recipe list list based on their alphabetical order based on the list ingredient and third option is for the reset of this sorting techniques and also you can delete that recipe item from your local database so basically it's a full-fledged application by the End of the video you are going to have an ree Search application which is not
UI was good but also it performance wise it is optimized so let's get started and create this beautiful application so first thing first go to the description box where you can find my initial project setup open it in your Android Studio you will see something like this and here I will provide you the dependencies that uh I will use in this project so all the dependency you can Find over here after that we are going to create modules so basically uh we are having two features the first feature is our search feature and second feature
is very simple media player feature so media player feature is not a typical feature it's a kind of functional Al so for that I will create a modules and also in order to manage our common resources I'm going to create one more module naming common so basically we have three modules here so let's create The modules first so go to the top file new here we are having a new module and choose Android library and give your module name so first I'm going to create my common finish it next I'm going to create uh media
player module so choose this Android library and give your module name media player and make sure this package name is g. himansu do media player okay and simply finish it all right so now it's time to create our feature module so file new new module And choose the Android library and within this I'm going to create a feature directory that contains our feature naming search so basically here I'm going to follow the hybrid approach of modelization in which we have a feature that contains three layers data domain and UI layer so for this search feature
I'm going to create uh UI module okay and this time make sure your package name would be Gansu search. UI okay and simply Finish it so yeah we have search feature that contains UI layer just like this we have to create two more modules or layer for data and domain so right click new here we are having module Android Library simply call this domain and go here upend search finish it up like this just right click new module Android library and this time we are having our data Layer and make sure to use search here
finish it up all right so we are pretty much done with our modules now it's time to see the API that we're going to use in this project so I'm going to use mb.com so this will provide a lot of free apis that we can use for this project so specifically I'm going to use this uh search API so basically if you type any recipe based on that it will provide you a list of recipes of course and if you Want to see the details you can use this API it will provide you details of
that particular meal or recipe cool so so I'm going to copy this uh API and come back to my project and uh we will begin in our project with data layer So within this I'm going to create few packages of course so first I will create dependency package which is Di and second I'm going to create our remote package so basically this will contain all the API steps that is Dealing with uh remote data source and uh like this we have local so it will deal with local data things like room database or any other
database that you want to use in this project uh like this we are having model so yeah basically here we are receiving Json okay so corresponding to that we will create few models and we will map this Json to our model of course and that is the use case of this particular model so we will put our Model classes in this package go to the Chrome browser here and I'm going to copy this uh response okay so I'm going to create model classes for this Json response so in order to do that just right click
new here I'm using plug-in cotlin data class file from Json okay so simply paste this thing and I'm going to call this recipe response makes sense simply generate it and here we are having our ree respon that Contains a list of meals so basically this object is used to transfer data from our back end to our user device okay that's why we will call this type of model classes data transfer objects so in order to make the suppression with our normal model and this data transfer object I'm going to change the name so shift F6
and I'm going to call this ree dto don't change the parameter me okay so we are having your Mills so don't change it because if you change you can You can't get the response properly because the in the Json we are having here Mals okay so due to this reason all right and sometimes when it doesn't find anything from the back end it will ultimately return null so in order to prevent app crash just initialize this thing with null and one more thing in our resp there are few parameters that eventually are occasionally come null
so in order to prevent the app crash I'm going to add question mark okay so I've Done it it's very easy you can you know pause this screen and you know follow this question mark thing which I have already done all right so now we are pretty much done with our model classes it's time to write the API integration so in order to write the API integration we require retrofit because I'm going to use a retrofit third party library to get the response from back end so first thing first I need dependencies in my build
dog. search basically build dog. Kts so we are having multimodular approach so each module contain its own build gdal file so here I'm using uh feature search data build gridle and just below to it I'm going to add few dependencies and dependencies is already present in ellips version toml so implementation uh we are having here lips first one is our retrofit and simply press contrl D and We are having here Json converter so this Json converter is actually used to convert your G response into your model classes all right and we will use here dependency
injection or you can say Hilt dagger Hilt so in order to integrate dagger Hilt in our project I'm going to you know add few dependencies for that lips dagger we are having Hilt here and for its annotation processor I'm going to use K and this will this will not work with Implementation so we have to use this Kap annotation processor so so in order to use this K we have to add few plugins on the top so first plugin I'm going to add for our dagger H so lips plug-in dagger and for the cin anotation
processor I'm going to use cotlin Kap that's it so simply sync your project okay so you will see error is gone now come back to our data module and here in the remote I'm going to create a interface so I'm going to call this Search API service and within this I'm going to write two API calls so first one is get uh let me import this get first okay suspend function get recipes uh we are having here queries so let me just copy paste the API links so now for the gete if you look out
this particular API this is our base URL and rest of the things is endpoint so I'm going to copy this thing from API to search PHP because this is endo so I'm Going to paste it over here and here we are having query s so in order to introduce query I'm going to use a query annotation and pass s over here this s is coming from our UI or you can say user interface all right so the response would be response and within this response we are having our ree response Okay so so we are
done with our get rest piece or you can say get search rest piece API integration now it's time To write the API integration for details so in order to write the details API integration just use this particular API Point suspend function get ree details and within this we are having query and this time query name would be I and I'm going to pass as a string okay now the return type of this API would be so I'm going to make a different data class for this and call this recipe detail response well Ms list of
RSP dto I mean the response is pretty much same It's not a different response it's the same response but the thing is uh now we have a clear suppression of concern now come back to search API service and here just use a response and make sure this response will coming from our retrofit package so we are having a response recipe detail response all right so we are pretty much done with our API interface now it's time to use dependence injection so I'm going to create one object within our Dependen injection package and I will call
this search data module so I'm going to use installing and within this I want to pass single Inon component this is a class and because this will represent a module or you can say dagger Hil module so we have to annotate this thing with module okay now within this we are going to provide few things so first thing which I will provide here is our retrofit so provide retrofit so it will ultimately return Retrofit let me import this retrofit first so in order to return retrofit I'm going to use a retrofit Builder so first the
base URL so as you know in our search API we are having this thing as a base URL so I'm going to copy this come back to data module and on the top of this uh module I'm going to create a conw and call this basore URL and paste it over here and this Bas URL is uh used in this particular function so yeah we are passing base URL now it's time to Add our converter Factory because as I told you our Json response is ultimately converted into our data classes so this conversion will be
happen with the help of this converter that we're going to pass just so gson converter Factory Jon converter Factory do create and lastly build it so it will provide a retrofit now we will write the search API implementation so it's not on us it's on retrofit so in order to provide the implementation I'm Going to create one more function naming provide search API service okay and return type would be our search API service and here we going to pass retrofit as a function parameter and we will take the leverage of retrofit and simply create our
search API service implementation let me correct this name it will provide the search JPI service implementation all right so we are pretty much done with our API integration now we will jump into our Domain layer So within our domain layer I'm going to create few packages first so first the package would be dependency injection then we are having package for our use cases and we are having our repository interface all right and also we are having here model classes so basically data transfer object is not used in our domain layer domain layer contain its own
model classes which ultimately used in our uh User interface or you can say presentation layer so I'm going to create uh two different model classes here the first one is for our recipe and second one is for our RSP details so for that I'm going to create a file and I'm going to call this uh domain model file all right so I have created this uh two data classes the first one is our recipe and the second one is our recipe details okay so in recipe details we have ingredients pair like uh which Ingredients require
to create that particular recipe okay so for this I'm using a list of pair that has a type string string now it's time to write the repository so I'm going to create a interface here and this interface name would be search repository and within this we are having suspend function get recipes okay and the return type of this thing would be a list of recipes okay so this recip is coming from our domain layer model Second one is our get recipe details so in order to get the details we require ID of that particular recipe
of course so it will give back ree details so we are pretty much done about this repository interface now it's time to write the implementation of this search repository so where do we write the implementation so well I told you data layer is used to dealing with data so here we are actually dealing with data basically we we try to get the recipe From back end logically this uh search poitry implementation will become from data layer soe to this reason we have to create a different package for this so in our data layer I'm going
to create repository and within this repository I'm going to create one class naming search repo impp and this will ultimately implement the search repository because search repository present in domain layer and data layer Didn't know about anything so due to this reason we have to connect our data layer with domain so in order to do that go to your feature search data and here just establish the connection so implementation project and within this project first we have feature and within our feature we are having search so search contain domain sync it all right so now
connection is established between uh data layer and domain layer now go Here simply import this all right so now it's time to implement it member so simply control I and here you can find the override suspend function get recipes and get recipe details so in order to make a network request call we have to pass few parameters in the Constructor like private while we are having our search API service so this is actually used to uh hit our back end and take the data back and one more thing in the get rest P we have
to pass the query the search string so actually I forgot that so in our search repository I'm going to to use here s okay so simply copy this parameter go back to your search repir implementation and paste it over here yeah I'm going to use here search API service get my recipe back and query would be S that is coming from the parameter as a parameter in this function so I'm going to return this uh thing but the thing is return Type of this search API service would be a response that contain respir response but
the actual requirement of this function would be list of Rees so in order to deal with this kind of situation we have mappers so mappers is actually used to map our dto to our domain layer model so let's create mapper first we create mappers in our data layer so right click I'm going to create a package naming mappers and within this mapper we have a file naming Of course mappers so it's not a class it's a normal file so here I'm going to create a extension function over uh uh list of recipes and I'm going
to call this two domain and the return type would be a list of recipe so here it's not ree it's ree dto because we are converting the dto into domain layer model so due to this reason okay now within this I'm going to use map I'm going to create a recipe object see so in place of ID mail It. ID mail like this I'm going to pass everything okay so this tag and S Str YouTube sometimes come null from the backend so in order to manage the app crash I'm going to pass here empty strings
this will ultimately map our data transfer object into a list of recipe so let's use it so go back to your search rep implementation in response we have body and within this body we are having our Mals okay and I'm going to use two domain so it will Ultimately convert all of the list of recipe dto into a list of recipe that uh is present in our domain layer model but the thing is there are few problems here what will happen if this particular API throw any exception so how do we handle it so in
order to handle it we're going to use result class so this result class is coming from the portal itself so I'm going to use that okay so in order to use that result class what I will do I'm going to change the return type of this Functions so go back to your search repository and here I'm going to use that result rapper okay so you can see over here it is coming from the codling so simply used it copy it and similarly we're going to paste it over here yeah we are pretty much done now
go back to your search repository implementation and just change this thing from list of recipe to result list of recipe and similarly in the recipe Details all right so now I'm going to use this result class response search API service. get rest B password string okay if our response is successful then only I'm going to use our result class and pass success and success value contain response we are having body and within this body we are having Mals and ultimately I'm going to use two domain so it will ultimately convert all of the Data transfer
object into domain layer objects okay so this is a case when we are getting success and what will happen if I receive anything else so on that okay then I'm going to use result and pass failure and this time uh we will pass exception so you can pass any exception you want so I'm going to pass here exception with message error occurred that's it and remove this return Yeah so we are pretty much done I'm going to use a return return keyword over here the requirement is a list of RP the return return type of
this particular function is the list of recipe with question mark so in order to prevent this question mark I'm going to use uh question mark orer So response body we are having males so I'm going to use uh let and this time I'm going to use a result success within this particular block and it.2 domain and What if uh the return type of this API call will be null so on that scenario I'm going to use a run block and simply return result. failure and pass exception error occur remove this thing and yeah now it
will work all right so similarly we are having here get rese details so yeah we're going to use same approach so well response use search API service get the ree detail pass your ID and here I'm to use if if our response is successful on that Scenario we're going to do something else we are going to return something else so for the else I'm going to return result failure and exception would be error occurred and for the success case I'm going to use the same approach that we did for this case so we are having
a response that contains body and within this body we are having Mals so if it is is not null then I'm going to use result success and pass our content and what if it will null so for that case I'm going To use a run block and I'm going to use the result failure and simply pass exception which says error ORD so for the success of course we require a mapper because previously we are mapping a list of recipe dto into list of recipes but here the case is different we are actually mapping a list
of recipes with recipe details okay so first thing first we going to check few things so if our M list is not empty Then we going to proceed otherwise if it is empty then we simply return the failure okay and if it is not empty then on that scenario I'm going to use it. to domain So It ultimately convert the list of recipe D into list of recipes but our requirement is recipe details so how can we do that so in order to do that I'm going to fetch the first element from the list and
now I'm going to convert this resed D into resed details so in order to do that we require mappers so Go to mappers and here I'm going to create mappers so this time we have function that has uh dto to domain and return type would be uh ree details okay just create a ree detail object and within this you can pass all of the required thing within this I'm going to pass these parameters copy this paste it over here because everything is same but at this time we are we don't have it we have uh
this as a reference Of this resp so remove this it so the last parameter would be ingredients pair okay so this is a tricky one so in order to create uh ingredient payers we require different function so I'm going to just copy paste that function because it's it's not a big deal it's a very small thing you can do it by yourself so this is a function it's a extension function over respo and within this extension function I'm going to create a list that has a pair string comma string Type and within this pair we
are having our string ingredients and across to that we having its measurement so it's a very simple function you can go through it you can simply pause it and look into this so get our empty function is actually you know check few things and return back if if it is a case of null it will return empty if it is not then it will return the isting ingredient it's a very basic function so I'm going to use this so This do get ingredient Pair with its measure so this function is actually used to convert a
res D2 into res details so I'm going to return this thing yeah now it's fine go back to search repository implementation and uh within this first I'm going to use two domain and rra this thing with result success okay so yeah we are pretty much done remove this thing and yeah it works okay so we are having two function here get res pce and get res pce detail so What we did here we are using mappers to map our dios into a domain layer models so this is the implement now it's time to provide this
implementation with the help of dager Hil so go to your search data module and within this write the provide function so function provide search repo and the return return type would be search repository ultimately you will return its implementation and the requirement of this implementation would Be search API service so simply pass it that's it now now you are able to inject reposit anywhere you want okay now come back to your domain layer and we are done with our repository things all right so now we will proceed with our use cases so first use case
is for getting all the recipes based on our query so for that I'm going to create a class and I'm going to call this get all ree use case and within this I'm going to use Constructor injection and I'm going to pass my search repository we are having here operator function in work that has our query and I'm going to use your flow operator so in flow operator I'm going to use uh the type Network result and within this we are having a list of RP okay so this is a network result so basically this
network result is used to transfer our event our Network event to be more specific from this use case to our view Model so now it's time to create this network results so go to your common module because common module is connected to all of our other modules so due to this reason I'm going to create here a package naming util so this is basically uh util resource so I'm going to paste this class into this particular package so in our utils we have two classes so first one is our Network result so I already told
you what is the use case of this seal class so it's a Generic seal class which actually used to transfer our Network event from use cases to view model so this UI text is a seal class which actually used to to convert your isting resources into a meaningful string so basically we use this UI text in our view model and if we are using in view model this UI text we don't need to pass context in order to access your isting resources so by doing this our view model is actually unit test table so we
can write unit test Cases for our view model so due to this reason we use this sealed class UI text and if you don't know what is this then you can watch my this video and in that video I'll explain everything for you from scratch so let's continue with our video so go to get all RSP use case so this is not accessible because our domain layer is not connected with our common module yet so let's connect that first so go to your uh domain layer build. kle and here I'm going to use Implementation and
we are having your project and within this common and simply sync it now go back to your get allp use case and uh within this I'm going to emit the first loading event that is coming from our Network result and then I'm going to create a variable naming response and I'm going to use my search ree get re function and pass my query now if our response is Success then I'm going to emit My Success event which is coming from Network result and Within this data I'm going to pass my response get out through so
if everything goes well it will return you list of rest pce otherwise it will throw an error so if it is uh not the case I'm going to emit the error event make sure this error event comes from Network result and requirement of this thing is messaged so I'm going to use my response get or here we are having exception or n and get the localize message okay that's it now if anything Goes wrong except this condition then for that I'm going to use here catch operator and within this I'm going to emit the error
event so make sure this error event coming from your network result in place of message I'm going to use the throwable message and pass it and I'm going to execute this flow on dispatcher doio so for that I'm using flow on function and pass my dispatcher doio okay so we are done with our get all recipe use case now it's time to Create our detail recipe use case so for that I'm going to create a different class and I'm going to call this get uh recip detail use case Okay so this is a class and
I'm going to use Constructor in injection here pass my search repository and similarly we are having here an operator function naming inoke and this time we need to pass the ID we're going to use flow Network result and this time we will receive recie details okay and First event would be a loading event I'm going to create a variable naming a response use my search repository get R details pass my ID in it and if our respon resp is Success then I'm going to emit a success event so make sure this success event coming from
a network result in the data you can pass your uh response get or throw so basically if everything goes well it will return USP detail otherwise it will throw an error so if it is uh not the case I'm going to Emit here an error event just like we previously did and in place of message I'm going to use my uh response do exception or null and it's localized message cool and if anything goes wrong except this condition then on that scenario I'm going to use here Network result error and pass my throwable message and
lastly I'm going to execute this thing on my dispatcher doio so now go back to your search Repository implementation and here we have to uh create few things not create few things but actually modify few things so this function body is actually wrapped with tri catch so suppose if anything goes wrong except this condition then we have to crch it and pass the network result failure uh pass your exception here and cut out the return keyword from here and paste in front of try similarly we have to use the try catch for this so try
and if Anything goes wrong it will catch the exception and I'm going to use here result failure and pass my exception cut out the return keybord from here and paste in front of try so that's it for our po implementation so now we are pretty much done with our data layer and domain layer now we will proceed with our UI layer so first in our UI layer we have to create few packages so I'm going to create few packages here in the search so first package name would be di So basically this is for the
dependency injection uh second we are having navigation and third we are having here screens okay now within this screen we are having two screen recipe list screen and recipe detail screen so I'm going to create here two packages within this screen so first one is uh recipe list and second one is for our recipe details okay and within this ree list I'm going to create my view model so I'm Going to call this uh ree list view model this is class and I'm going to use here Constructor injection so private well and I'm I'm going
to use uh get all uh recipe use case so if you want to access this get all recipe use case this is present in our domain layer or in domain module so you have to add this particular line in your build. g. kts otherwise it is not accessible so basically I did this thing previously so due to this reason I'm able to access The uh get allp use case and also I have added few dependencies one is for the dagger H if you notice in this uh build you will see it's here and also on
the top I have added plugins so due to this reason everything is accessible to me so now you're going to use your event driven architecture so for example if you if user click any button so it's an event that event comes in our view model and based on that we will decide which state we have to update or we need to Update for that I'm going to create here an object and I'm going to call this uh recipe list so within this object we we have three things first is the navigation second is the events
and third our UI state so for the UI state I'm going to create a data class naming uh UI State here we are having three parameters the first first one is Boolean loading second is our error so this error is actually a UI text and initial value would be UI text. IDL Lastly we are having our actual data which is uh list of recipe okay and I'm going to initialize this thing with null so second we are having here a seal interface naming and navigation and within this so what will happen when user click any
of our uh recipe so we will try to see the re details so in order to show the re detail we have to perform a navigation and that navigation is present within this cind interace I'm going to call this data class that says Go to recipe details and this thing contain the ID of particular recipe so that we will extract the recipe detail for that and also use this navigation so now it's time to write some events so I'm going to create here a seal interface uh naming event so for the Tim being just leave
it uh when we proceed with our video we will see the events and after that we will add that event within this interface all right so now come back Back to your view model and make sure to extend this particular class with view model otherwise you will not receive the view model properties within this class so I'm going to create here uh private well UI state which is initialize with the help of mutable State flow and within this I'm going to pass an object of UI state so I'm going to create uh UI state which
is actually a state flow and the type of this thing would be UI UI State and I'm going to use get here and Initialize this thing with UI state that we have on the top and I'm going to convert this in a state flow okay so we are done with that next we are having a function which actually used to uh search the ree list based on our query so I'm going to call this search pass our query here and within this I'm going to use a view model scope so this View model scope is
uh not accessible because uh we didn't have the dependencies for that so Go to your uh feature search uiu dog. kts and here I'm going to implement the dependency so lips. life cycle do view model simply sync your project now go back to your spil view model and now you'll see it is available so I'm going to create a core routine and within this core routine I'm going to hit my API for that I'm going to use get all RSP use case and use this inoke pass our query in it and on each emission I'm
going to call this variable Result so when our result is loading and we have two more we have here error and we have here success okay so if our result is loading then what we are going to do well we are going going to update our UI State okay and within this UI state I'm going to create a new object of our UI State and in place of it's loading I'm going to pass true okay similarly I'm going to copy this and paste in my error so if anything goes wrong so on that occasion I'm
going to Create a new object of our UI State and in place of error I'm going to pass UI text here we are having a remote string and pass my message so this message coming from our result and just convert this thing into string so sometimes it uh may come null so we have to prevent the app from Crash so due to this reason I'm going to stringify that null all right so again I'm going to copy this from loading and paste in our Success so in success this time we will pass our data so
in place of data I'm using the result. data I'm going to use here launching view model scope I remove this view model scope. launch because there is no use for that yeah so this is our API call now it's time to write some events so the first event would be when user types something we have to trigger our API so in order to trigger our API we have to Create a data class naming search recipe and we have to pass our query this will extend the event okay so this is our first event for the
time being and I'm going to create a function for that so function on event and in this I'm going to pass my event the type would be event and make sure this event is coming from our own view model package I'm going to use here when and pass my event and complete the auto Suggestion so we have only one event for the timing and I'm going to use this so it's very easy to use you can call this search and pass your event. query that's it now it will ultimately update our UI State and we
are able to observe the changes of this UI state in our composable and update our UI accordingly let me make this function private because we are not using this function out of this view model class so yeah this is our view model and We are pretty much done with our first view model which is res list view model now it's time to create another view model for our detail so for that I'm going to create a class and this time I'm going to call this uh ree detail view model so this is a class and
I'm going to use here Constructor injection pass my private while getp detail use case and make sure to extend this class with view model so that we have all the properties of view model within this Class now this is same we have a same behavior like just uh we did for our spdv model so we have a object and I'm going to call this object recipe details and within this we are having event we are having UI State and we are having navigation so first I'm going to create a data class and I'm going to
call this UI State and within this we are having is loading type is Boolean initial value would be false second one is error type is UI text and initial value would be Ideal and lastly we have our data and data would be RP details make sure to import the correct one and initialize this with null so similarly we are having here navigation so for time being leave it similarly we have events for time being just leave it okay so here I'm going to create a private while naming a UI State this must be uh initialized
with the help of mutable State flow and here we are having UI State and this uh UI state is coming From ree details all right so I'm going to create one more variable which is you know expose this UI state to our composable and this is a state flow and uh type would be UI State make sure this is coming from our RSP details and I'm going to use here get and use my UI State and convert this into State flow now I'm going to create one more function which actually Fitch the ree details for
that we require ID and I'm Going to pass that ID and I'm going to use my get res detail use case uh invoke pass my ID and I'm going to use here on each and I'm going to call this thing result so when our result is uh loading error or success so I'm going to take this suggestion so for the error I'm going to update my UI state with the help of uh UI state that is coming from our RSP details is loading event true and I'm going to copy this particular thing and paste for
these two Cases reformat it so for the loading it's fine for the loading it's true for the error this time I'm going to remove this is loading and pass here error UI text remote string result do message and convert this thing into a string and for the success remove this parameter use data and use the result data and finally you can launch this thing in our VI model scope okay so this function is actually used to fch the RP detail and it It ultimately update our UI State okay so for fetching the uh recipe details
we are having an event so for that I'm going to create a data class and call this uh fetch ree details and I'm going to pass the ID okay on the top I'm going to create one function naming on event and pass my event so this event is coming from our ree details and I'm going to use when expression here to check the event type pass my EV event so we have only one event which is fetch recie details okay So if it happens I'm going to use my re detail function and pass my event
ID so yeah we are pretty much uh done with our spail view model so make this function private because we are not using this function out of this view model so now it's time to set up our navigation for this project so in order to set up navigation in multimod architect project we are using different approaches because we can't do navigation by connecting our UI layer With another feature UI layers because if we are trying to do so we are able to perform the navigation but the thing is ultimately in future we are going to
end up with circular dependency so in order to avoid the circular dependency what we are going to do every feature contain its own navigation subgraph and this navigation subgraph is provided with the help of dependency injection and we will take this navigation graph in our app module because our app module contains The main navigation graph so ultimately we receive this subgraph with the help of dependency injection framework and we will connect this subgraph in our main graph so by doing this we avoid the circular dependency and also we are able to perform navigation wherever we
want so let's see how we can do it so in order to do this first go to your common module because there are few things that uh is actually accessible by all of our feature modules so in our navigation I'm Going to create an interface called this feature API contain a function naming a register graph so as I told you we are going to register our navigation subgraph with the help of this register graph function so this contain the navigation graph Builder uh let me add this uh dependency for navigation in our common module so
go to your uh build. gr. kts and here I'm having my dependency so it's uh lips navigation Compose sync it come back to feature API and here we have nav navigation graph Builder and second we have a nav host controller all right so now come back to your UI layer and in this UI layer we have navigation and within this navigation I'm going to create a file naming navigation this is a file and within this file I'm going to create one interface which is specific to this particular module and I'm going to call This search
feature API so this will ultimately use our feature API and just below to it I'm going to write its implementation so search feature API IML is ultimately use search feature API and we are going to write its implementation but the thing is our U layer doesn't know about this navigation graphs and navigation graph Builder so I'm going to my build. g. kts and here time to add the dependency so lips. Navigation. compose sync your project come back to your navigation and now it is available so within this I'm going to use my na gra Builder
this will contain navigation so this navigation is ultimately used to create a navigation subgraph within this I'm going to pass its route first and second its start destination so now it's time to create a routes for this particular navigation subgraph and also for our screens so go back to your common module and within This navigation I'm going to create a file naming navigation routes so this is a file and within this I'm going to create a seal class naming navigation route we are having route here and within this we are having data object ree list
navigation route and in place of route I'm going to pass recipe underscore list similarly we have data object for uh recipe details and uh I'm going to use a navigation Route we have here RSP details and in place of argument uh I'm going to use Name ID So within this data object I'm going to create a function naming send ID pass my ree ID within this and it will ultimately uh return back the route so route that contains uh recipe uncore detail SL the ID that be passed within this function now as I told you
this is a navigation subgraph and navigation subgraph has its own route so in order to create their route I'm going to Create one more seial class naming navigation subgraph route and they contain their own routes so for the time being we have only one and this is search and I'm going to use a navigation subgraph route and in place of route I'm going to pass SL search that's it come back back to our UI layer and within this route I'm going to use navigation subgraph route this contain search I'm going to pass it Route so
our start destination would be coming from uh navigation route re list route okay now within this we are going to use composable and in this composable parameter would be route so if our route would be list route I'm going to render my re list screen and if it is not the case it if it is a case of detail one navigation route re detail and it's route and within this Lambda I'm going to use my res daily screen I'm going to provide This implementation with the help of dagger Hilt within our DI package I'm going
to create an object and the object name would be UI module and I'm going to use install in and install in single turn component because this is a module so we have to annotate it with module okay so now here we have provide function which actually provide this search feature API implementation okay search feature API return the search feature API Implementation cool so now this will injectable in any place of our project cool so we are pretty much done with our navigation so now we will proceed with our app module so first thing first I'm
going to add few dependencies and also connect our app module with all of our other modules so here I'm going to use implementation lips. navigation. compose and also I'm going to use dependency injection here so for that I'm going to use lips. Dagger. Hilt just press contrl D and in place of Hilt I'm going to use its annotation processor Kap so change this implementation with Kap and on the top I'm going to connect this module with every module so implementation we are having your project and within this project I'm going to connect first with our
common module just press controll D and this time I'm going to use my feature search so search uh we are having data just like this we are having Domain and lastly we are having UI and one more module we are having for our media player so media player okay and on the top we are going to add few plugins so lips plug-in dagger and also in order to use K I'm going to add this string C link AP now sync my project go to your app module and within this app module I'm going to create
a class naming base app and this base app is actually extend with the application and I'm going to this thing With Hilt Android app go back to your app level Android manifest and add this class now I'm going to create a package naming navigation and within this navigation I'm going to create a file naming of course navigation so this is a file and within this navigation I'm going to create one data class and this data class says navigation sub graph okay and this thing contain first our Search feature API all right now I'm going to
create a package for our dependen injection and I'm going to create a object an object within this uh dependency injection package which says app module all right and uh within this app module I'm going to write a provide function with which ultimately provide me my navigation subgraph so navigation sub graphs okay and the input of this is search feature API and the return type Would be navigation subgraph not subgraph route you have to choose your navigation subgraphs which is present in your app module I'm going to use a written keyword here and navigation subgraphs search
feature API so in order to use this as dagger Hill module we should annotate this thing with module and also I'm going to use install in singl ton component class okay so now this particular thing is injectable go back to your uh main activity and here I'm going to anate my main activity with Android entry point and I'm going to use here field injection let in it War navigation subgraphs all right now go back to your navigation file and here I'm going to create a composable and I'm going to call this ree navigation and within
this I'm going to use uh nav host so the requirement of this thing is na controller and the graph so in place of Graph I'm going to use a start destination and on the top I'm going to create nav host controller remember nav host controller and simply use this uh thing here and in place of start destination I'm going to use my navigation subgraph route search route all right so now within this composable I'm going to pass uh navigation sub graph and I'm going to use my navigation subgraph it's search feature API Register graph function
and within this I'm going to pass my nav host controller and also my navra Builder so in place of navra Builder I'm going to pass this so we are done with our recie navigation composable now go back to your main activity and here in place of scaffold I'm going to pass a surface and this surface is actually having a modifier safe content padding and within this I'm going to pass my ree navigation so the requirement of this thing is Navigation subgraph so here I pass it so yeah it's a complete setup for a navigation so
we are pretty much done with our navigation here let's rebuild this project and see if we have any problem we will try to fix it okay so we are having one problem and the problem is our C extension version number so it says 1.9.0 uses 1.5.1 but uh I think we are using C version 1.9.2 to so in your build dog. kts in your common module if you check it says 1.5.1 so convert this Thing with 9 sync your project and rebuild this okay so we are having one more problem and I believe this problem
arises because I don't have the plugin for our dagger H here in the project level so I'm going to add this plugin and again sync my project okay time to rebuild this project all right so our build is successful that means everything is fine so now we will begin with our user interface so first I'm going to create my recipe listed screen So for that I'm going to create a a recipe list screen naming file and within this file I'm going to create a composable so a recipe list screen and within this I'm going to
create scaffold okay uh this scaffold contain a top bar so I'm going to use top bar and within this top bar I'm going to use text field okay so in place of value I'm going to create a state so remember savable mutable stateof and I'm going to initialize this thing with empty Use this query value here in place of value and if anything changes I'm going to update my query value all right after that we are having colors and in order to change the text field colors we have text field default do colors so I'm
going to change Focus indicator color and also unfocused container color so unfocused container color would be transparent and focused container color would Also color. transparent and unfocused indicator color is also transparent all right after that we are having here modifier fill Max width and we are done with our text field now it's time to use our view model UI state so for that I'm going to pass here view model which is ree list view model and I'm going to use a variable Nam UI State and use my view Model UI State collect this thing as
a state so that if anything changes we should update our UI accordingly first I'm going to check my UI State value if it is a case of loading I'm going to render a box having modifier pading which is coming from this particular Lambda so I'm going to pause it after that we are using filmax size and after that content Al ignment on the center we have circular progress indicator like this we are having error So if error is not the type of UI text IDL that means we are having problem and in order to show
the problem I'm using modifier pading filmax size content alignment on the center and within this we are having text UI State value error get string so this get string is actually present in our UI text go back to your ree list screen now it's time to write our success case so UI State value data if it is not null that means we are receiving list of recipes and in order To show the list I'm using lazy column so this lazy column have modifier first thing our padding values and after that I'm going to take the
complete size within this we are having items pass your list and within this Lambda you can pass your list item so for the list item I'm going to create a card so this card having modifier fting horizontally 12 DP and vertically let's say 4 DP import this DP and after that we are having shape so I'm going to use a rounded Corner shape to ldp okay so we are done with our card now we are going to load our image with the help of URL so in order to do that we require Quil image loading
Library we are going to add the dependency in our UI layer So within our UI layer I'm going to use implementation lips. coil. compost and simply sync it go back to your recie list screen and here I'm going to use Async image pass my St Str M thumb content description would be null I'm going to use modifier fil Max width its height would be 250 DP lastly we are having here content scale so I'm going to pass for the time being content scale crop then we are having spacer here to use space so I'm going
to provide 12 DP space and after that we are having our mail name so this mail name is coming from s Str M and in place of style I'm Going to use my material theme typography body large just after that we are having spacer having modifier height would be 12p and now it's time to create our tax so if our St Str tax is not empty then only we will render this UI so in this UI we are having floro so this is an experimental API so annotate our composable with experimental layout API and within
this we are having our it. SDR TX and I'm going to use split Function here my reject is comma so basically St Str tag comes in a form of comma separated string we are iterating each of our tags and render our UI we are having box having a modifier uh R content size content alignment on the center and within this we are having text pass our tag here and lastly we are having a style so material theme typography style should be body small and lastly we are having modifier so Modifier pading is horizontally 8 DP
and vertically it's 4 DP our box is also having some shape so for that I'm going to use background color would be white so color white and shape is rounded Corner shape to ldp all right just like this we are going to use clip and pass our shape rounded Corner shape to ldp and lastly we are having border so in place of Border I'm going To pass it with 1 DP and then we are having color so in place of color I'm going to pass red and in face off save again rounded corner savee to
ldp all right so we are pretty much done with our UI so after this Flor I'm going to create a spacer having modifier height 12 DP all right so we are done with our resp list screen now on the top I'm going to create a function on click and when user click our uh recie item then I'm going to pass my mail ID from this function to our parent composable so go to your card here and uh after this uh ping I'm going to use clickable event on click invoke and pass our it. ID mail
okay now I'm going to use this ree list screen in my navigation so here in my navigation we are having composable RP list screen so I'm going to use a recipe list screen pass our view model so in order to pass it we have to create it first to view model we are having Here Hilt view model so this is not available because we don't have dependency for that so go to your UI layer and add that dependency so for that I'm going to use implementation lips. hilt. compost. navigation now sync it go back to
your navigation and here you can see it is now available so import it and uh the type would be a recipe list view model and now pass your view model all right and one more thing I Forgot to add this annotation Hilt VI model on the top of our VI model so you can do that all right so we are pretty much done and one more thing in our Android manifest you have to add this to permission because we are going to use internet so in order to use internet we require permission so use it
all right so now I'm going to execute my app so our app executed successfully but the thing is our text field is not visible because I'm not using any kind of Placeholder we will do that but first let's check out the functionality so if I type chicken here okay so it didn't work so let's go back to our re list screen and here the problem is uh when user change anything we are going to use our view model on event function and I'm going to send my event so list event we are having searp pass
our query do value all right and one more thing we are forgetting to add the placeholder so let's add this thing First so we are having a text which says search here and two dots we are having style which coming from Material theme typography body small now execute this app again all right so our app executed successfully and here if I type chicken you will see all the recipes based on chicken but the thing is a UI is not looking very good but the functionality is working perfectly fine as we expected so here if you
see the TX the TX doesn't Have any space in between them and also everything got stick to the left of our card so we're going to fix everything so come back our uh ree list so here we are having recie list and I'm going to close this thing so first thing first I'm going to put all the things except this async image and spacer this thing into a column so for that I'm going to create a column first and this column is actually having modifier filmax Width and after that we are having horizontal padding of
16 DP and now I'm going to put everything within our column and one more thing before the filmax width I'm going to use padding so this padding is actually used vertically between our text and this text I'm going to create a text and this time I'm going to show the instructions and I'm going to use style which is coming from Material theme Typography and I'm going to use body medium okay just below to it I'm going to use a spacer and provide height of 12 DP and now it's time to modify our tags So within
our tag we have box so I'm going to provide horizontally padding 8 DP and vertically 4 DP okay and we are going to increase the radius from 12 to 24 similarly here and similarly here uh we are going to add pading for this text And it's already there so I'm going to increase the horizontal pading and vertically let's say 6tp now when I execute my app and I'm going to type chicken again so now this time we are having our instruction to but thing is instruction is very big so we're going to fix it but
first thing first we going to look out the tax uh yeah tax looking good it's not that bad so come back to our project and The instructions is actually have overflow so I'm using here ellipses and MAX Line would be so now when I execute my app it okay so I'm going to type here chicken okay yeah so yeah this is looking fine okay so when I see the tax uh tax is also good so yeah we are pretty much done with our recipe list screen now it's time to design our recipe detail screen so
go back to our project so First thing first we perform uh navigation so in order to perform navigation we already introduce on click here and ultimately we are receiving this event in our navigation so what I'm going to do here I'm going to use my view model on event and pass the event which is uh not created yet so go to my event and within this event I'm going to create a data class go to RSP details and pass my ID or you can say m ID all right come back to navigation and This time
we are having go top details and we are receiving mail ID so I'm going to pass this mail ID all right go back to yourp list view model and here we have to use all the branches within our wi expression so yeah it's done now I'm going to create a variable for the navigation so private wellcore navigation type is Channel and type would be navigation so this navigation is ultimately coming from our ree list all right just below to it I'm going to Create a navigation that is exposed to our composes so this is a
flow let me import this flow uh this cor routin flow okay and the type would be same uh navigation that is coming from our SP list and I'm going to use this navigation and convert this into H flow all right so now go back to your navigation and here we already created go Tope details okay so now go to the top and here in the event I'm going to use a view model scope launch a core Routine and I'm going to send the navigation which is go to ree details and from the event I'm going
to fetch the ID all right so we are pretty much done with our things in view model now go back to your rest list screen and here I'm going to create a variable naming life cycle honor and this is initialized with the help of local life cycle owner. current and I'm going to use a launch effect Pass my view model. navigation and within this I'm going to collect this navigation so view model navigation flow with life cycle and I'm going to use my life cycle on a do life cycle and simply collect the latest emission
all right so when our it I mean the navigation so let me use this suggestion okay so we are having this uh branch and I'm going to use this branch and within this I'm going to use my nav host controller but uh I'm not receiving This thing from my composable so I'm going to add this na host controller and pass it from my parent composable from here so nav host controller pass your na host controller now go back to your resist screen and this time we are having nav host controller and we're going to perform
navigation so we are having a navigation route recie detail and within this we have one function naming send ID and we are receiving ID from our it so it. ID by doing this we Actually perform the navigation all right so now it's time to design our ree detail screen I'm going to create a file naming detail screen and within this I'm going to create a composable naming uh ree detail screen all right so within this I'm going to pass my view model and we are passing a detail model because this is a resp detail screen
and first thing first I'm going to use uh UI State just like we did for our list Screen uh view model UI State collect as state okay and here I'm going to use scaffold again and this scaffold have top bar and within this uh I'm going to create my top I bar so this time we are actually having top I bar okay so this is an experimental material API so we have to unate our composable with this and title would say the actual name of our meal so ultimately it is a text that is coming
from our UI State value do data but the Thing is sometimes it may be null so yeah it is nullable so I'm going to use here question mark operator and pass my SDR meal okay after that I'm going to use two sting so that if anything goes wrong it doesn't didn't crash my app lastly we are having Styles so I'm going to use material theme typography and uh body larges good this is our top app bar and now here I'm going to use our UI State value is loading if it is loading again The same
composable that we had created for our let pist screen so modifier padding fil Max size content alignment on the center and we are having circular progress indicator okay so this is for the loading case now if our UI State value error is not equals to UI text. IDL that means something goes wrong and I'm going to use again box modifier pading filmax size lastly we have content alignment on the Center and uh within this we are having text we are going to use our UI State value error and simply use get string okay so these
two are for our loading and error now it's time to write our maini I mean for the success case so I'm going to use here U State value data okay and this will ultimately uh return me resp detail yeah this one all right so first thing first uh I'm going to show an image of course so we Here we are having async image and I'm going to use my ree detail. St mail thumb content description would be null and if we are talking about modifier so modifier is actually filmax width and height would be this
time 300 DP let me import this uh DP all right and I'm going to use a column on top of everything so this is AUM column having uh modifier fill Max size and uh I'm going to use here its vertical scroll behavior And remember scroll State I think yes so this will ultimately introduce the behavior of scrolling within our column so yeah we are done with our async image that is present in our column just below to it I'm going to use spacer to give space so modifier height uh 24 DP just below to it
I'm having my text and this time I'm going to use my recipe detail SDR instructions and I'm going to use style here material theme Typography body medium all right after that I'm going to add spacer so modifier height uh let's say 12 DP all right so now I'm going to use my RSP detail ingredient pair and I'm going to perform the iteration and within this we are having row and this row contain an async image here we need to pass the image URL but we don't have image URL we have the ingredient name now I'm
going to write a function which actually convert this name into a ingredient URL all right so This is a function which actually used to convert the ingredient name into its image URL so I'm going to use get ingredients image URL here and use my first so from the pairer I'm use first and and second is actually representing the amount of that ingredient we are done with our async image and here I'm going to pass modifier and within this modifier uh I'm going to use background color which is white and lastly shape which is circle Shape
and also I want clip so that if uh anything goes out of this uh shape we're going to cut it out so I'm going to use circle shape so this is our async image and we have a text and this text is actually coming from our pairer second and I'm going to provide a style from Material theme typography body medium is fine okay now it's time to modify the ru so I'm going to use modifier modifier fil Max width and after that I'm going to introduce padding so pad ing uh is Horizontal 12 DP and
after that I'm going to use here its horizontal Arrangement so horizontal Arrangement space between so just below to it I'm going to create a spacer having height 12 DP and Below to it we are having a text showing that watch YouTube video okay and style is coming from our material theme typography uh body small all right and just below to it I'm having one more SP and this time height would be 32 DP so yeah that's it For our uh ree details all right cool now I'm going to use this re detail screen in my
navigation okay and I'm going to pass this re detail screen okay but the thing is we need a view model so let's create it while view model we are having here Hilt view model and the type would be ree detail view model when you click it says pass your view model so I'm going to pass my view model all right now we are sending the mail ID from our ree list screen to This uh ree detail screen now it's time to extract that thing mail ID and it do arguments and within this I'm going to
extract this string and the ID would be ID all right so if our mail ID is not null then I'm going to use my view model so we have to put our view model on the top of everything and now I'm going to use uh my view model and send an event so this time make sure your event is uh come from your RSP detail okay and here we are having fetch RSP details so use It pass your mail ID so yeah that's it and we are pretty much done with our RP detail screen it's
time to execute our app and see whether it is working or not all right so our app executed successfully I'm going to type here chicken and I'm going to click onto this chicken Hy and yeah here I have everything so basically this is our ingredients so image is very big so we will fix that but the thing is functionality wise uh We are doing everything perfect so now go back to your uh project it's time to fix our ingredient uh size so to do that go to your ree details and on the bottom we are
having this for each iteration and here we are having our async image and within our modifier I'm going to give the size UH 60 DP all right and one more thing in the row I'm using vertical alignment all right and one more thing I'm going to use padding so you can see Our text is stick to the left of our screen so I'm going to provide some padding so to do that uh we have one way so on that approach we have to go in all of our UI element one by one and add the
modifier but that thing is not very good because it will take time so what I'm going to do in here I'm going to put everything within a column and I'm going to add modifier and provide padding horizontally 16 DP and vertically uh let's say 12 DP all right so now I'm going to execute this thing again okay I'm going to type here chicken chicken spelling is wrong okay chicken Hardy click onto this so for the time being we are receiving null here so how should we fix that so go to your project and in the
navig I'm going to use here and here I'm going to use launch effect so if our mail ID got changed then only I'm going to execute this block all right so now execute our app One more time all right so now I'm going to type chicken here click onto this and yeah we are having the details and when you go on to the bottom we are having problem because sometimes we are receiving uh exting ingredient empty and its instruction is also empty in our paer so in order to fix this go to your resil screen
again and on the bottom we are having ree details ingredient pair for each Loop and here we going to check so it First is not empty or it do second is not empty then only we are going to render our UI so just copy this piece of code paste it in our if block now execute our app again all right type chicken here click onto this go to the bottom and now you are not seeing any of the ingredients which doesn't have image and the amount of that ingredient so yeah this is our RSP detail
screen and one more thing we are not using content scale for this image So due to this reason this image is actually getting padding from the left and right side so we're going to fix that go to our async image so this is the actual approach this is a way developer actually debug their application so let's put content scale crop and uh increase this 300 DP to 350 and now execute your app again and here I'm going to type again chicken open it up and yeah yeah there we go we are having our resp detail
Screen so yeah we are pretty much done with our resp detail screen now it's time to introduce the casting feature so suppose you like this recipe and you want to save it in your local database for future use so how can we do that well we are going to do that with the help of a room database so let's get started the caching mechanism for our application so first we are going to create few action icon over here the first one is for the saving and the Second one is for the deleting from the database
so go back to your RSP detail screen and here on the top we are having top I bar now this top I bar is having Navigation icon and actions So within this action I'm going to create my icon button okay this icon button contain an icon which is coming from image Vector remove this Painter with image Vector icons default star not search but star content description would be null Okay and similarly we are having one more icon button and this time we are having icon that is coming from our uh image Vector icons default delete
content description would be null all right so this is our icon button and in place of uh Navigation icon I'm going to create and icon do default do Arrow so I'm going to use here Arrow back and the content description I pass null okay so what what happen when user click onto this Navigation icon then I'm going to use here a modifier clickable event and simply pass this event to our parent composable so to do that I'm going to use here on navigation click and similarly we are having here on delete and we are having
on favorite click and both the time I'm going to pass myp detail so make sure this re detail is actually coming from our Domain layer so I'm going to use this RSP detail simply copy it paste it over here all right so for the time being I'm not using this on delete and on favorite click because we will use this thing later in our video for the time being I'm going to use on navigation click so on navigation click. inoke all right so now go back to your view model and here introduce navigation so before
introducing a Navigation I'm going to create few data objects so first one is go to recipe list screen and this is a navigation now I'm going to create a private variable _ navigation which is initialized with the help of Channel and the type would be navigation make sure this is coming from our resp detail all right so like we did before we are having navigation which is a flow and here we are having our Navigation make sure this is coming from our RP detail I'm going to use get here navigation receive as flow all right
so I'm going to introduce an event so go to your event and I'm going to use data object go to recipe list screen and use it with event now go back to the top and introduce the remaining branches so for that I'm going to use here view model scope launch navigation so now I'm going to pass my Navigation okay so this navigation contain the go to list screen data object and I'm going to send this now I'm going to use this thing in our resp detail screen so open this screen resp detail res detail screen
okay so just below to our UI state I'm going to create here life cycle honor local life cycle honor. current and we are having here launch effect view model navigation and within this we are having view model navigation flow With life cycle pass our life cycle onor do life cycle and ultimately I'm going to collect the latest emission so when our navigation let me use this suggestion so when it is a case of go to P list screen I'm going to use here the nav host controller but I don't have nav host controller so let
me pass this nav host controller in our composable and now I'm going to use it here so nav host controller. navigate so instead of Navigate I'm going to use pop back is tag because we are coming through that screen so yeah we will go to the rest screen when we pop that all right so we are pretty much done with the navigation stuff so now it is time to introduce our room database so in multimod architecture the best place of putting your app database is app module because app module knows everything regarding your project like
if you have a lot of feature then every Feature is connected with your app module so for me it's a best place to put our app database so I'm going to put it over there so first thing first we need dependencies so go to your build. kts in your module app and here I'm going to write the implementation so lips. room. KTX okay justr D next we are having the compiler so add this and remove this implementation with KT now sync your Project okay so syncing is done now go to your app module and uh
within this app module I'm going to create one package naming local and within this local I'm going to create an abstract class naming app database so this is a class make sure it's an abstract class that ultimately uses a room database and within this I'm going to create an companion Object and we are having function naming get instance pass the context here and uh I'm going to use a room database Builder pass my context and the type of this database so app database class. Java and lastly we have Nam so I'm going to pass uh
uh ree appcore DB so I'm I don't want to use any kind of migration here so for that I'm going to use fallback destructive migration and lastly I'm going to build it all Right so on the top we are having here database annotation and within this we are having entities and also we are having version so this is a our first version and I want my es schema to not be imported so for that I'm using export schema false go to our domain layer object which is present in our search domain layer and here we
are having domain model file within this we are having our recipes so I'm going to store this rece so in order To convert this recipe into an entity we have to annotate this thing with entity but the thing is dependencies are not there in our build. G so go to your domain layer build. g. kts and simply add the dependencies so implementation lips room KTX and just press contr D and use its compiler with Kap sync it go back to your domain model file and now here you can see it's available so every entity has
it's Primary key so for that I'm going to use primary key and I don't want this thing to be autogenerated now I'm going to use this uh recipe in our basically na database so here we are having recipe class so basically we are having only one entity so I'm going to pass this RSP class all right so now we are done with our database creation now it's time to provide this dependency or app database with the help of app module So go to your app module and here I'm going to use provide function provide app
database and we are having here application context which actually return the app database get instance context so it will give me the instance of our room DB and make sure to add this single turn because I don't want to create this app database instance again and again all right so now it's time to go into Your data layer and within this lat layer we have created this local and within this local I'm going to create data access object this is an interface and I'm going to call this uh recipe data access object so this is
an interface and make sure to annotate this thing with Dow so this Dow is not available because we don't have dependencies in our build. gr. kts so go to your data layer and add those dependencies so in the bottom I'm having Implementation lips room KTX and for the compiler I'm using compiler and change this implementation to cap sync your project go back to your recipe Dow and now it's available okay so here I'm going to use first insert and having onc conflict strategy replace so basically if you pass the same ID ree two two times
then it will ultimately replace the previous one with the newer one suspend function and we are having insert a ree pass your Ree we are going to use its delete so suspend function delete recipe pass your recipe all right so now it's time to get back everything from this datab bag so I'm going to write query for that select asri from Ree so this is a function get all recipes and it will ultimately gives me flow so make sure this flow is coming from cotton X Corin flow list of recipe all right so we are
done with our Insertion deletion and getting all the recipe list now lastly we are having update suspend function update recipe recipe all although we are not going to use this update function but uh for the sake of uh Simplicity of the C operation I'm going to create this update so now it's time to implement this interface and provide it with the help of dependency injection framework so now go to the app module and here we Are having provide function provide uh ree data access object so for this we require the app database and the return
type would be re Dow so a return return keyword with ab database. ab database. getet instance so basically in order to implement this reow go to your app database and here create an abstract function get row and it will return me row go back to your app module and now we are having Here get rest P so we are done with the implementation of our data access of object so now it's time to go back in our RSP detail view model within this we are having few more events so basically from the detail screen user
is able to add the recie in our local database and also delete it so basically here we are having two events so go to the event seal class and here add those events so a data class insert recipe and pass your recipe details Uh so detail this is coming from our domain model and this is actually use event similarly we have data class for deletion so delete ree wall ree details and ultimately it use event so now I'm going to use this thing in our on event function so here we are having two more events
deletion and the insertion but the thing is we are receiving ree detail and requirement of our database would be recie so we have to write a Mapper class for that conversion so let's do that within our view model so in view model I'm going to create a function which actually use the uh recipe detail and convert this thing into recipe so the return return type would be Ree and I'm going to use here return keyword recipe okay so now I'm going to use this two recipe in my events within here we are going to use
the use cases but we don't have any use case till now So first let me create the use cases first so go to your use cases and here I'm going to create a use case naming insert recipe use case so this is a class and I'm going to use Constructor injection and inject my repository so this repository is actually search repository okay and I'm going to use this search repository but but the thing is search repository doesn't contain any insertion logic or any function that is used to insert our recipe in our Database so first
thing first go to your search repository and here add few things so the first one is insert recipe pass your recipe second is delete recipe pass your recie and lastly we are having function get all uh Rees so return return type would be flow list of recipes so now go back to your implementation and here just press contr I and Implement all the function so for the insertion uh we need the data access object so here I'm going to add the data Access object which is a RP data access object now I'm going to use
my ree data access object do insert and pass my recie for delete I'm going to use my recipe Dow delete pass my recipe for getting all the recipes I'm going to use return recipe Dow do get all recipes all right so we are done with our repository part now go back to your insert re use case now this search repository will have everything so I'm going to use operator function Inoke here pass myp within this so it's a flow operator and the the return type would be unit okay so within our search repository we are
having insert recipe pass your recip and lastly execute this flow on dispatcher IO okay so we are done with our insertion use case now it's time to write the delet and use case so delete ree use case okay this is a class and I'm going to use again Constructor injection private well search Repository And within this I'm having operator function invoke pass your RSP flow type is unit and within this I'm going to use search repository. delete and I'm going to pass myp okay execute this flow on dispatcher doio all right lastly we are having
the get all recipes from local DB use case so again this is a class and I'm going to use inject Constructor private well Search repository and within this we are having operator function invoke and I'm going to use my search repository get all Rees all right so we are done with our all use cases go back to your re detail view model and on the top I'm going to use these use cases so private while delete recipe so delete recipe use case next we are having private well insert RSP use case and I'm going to
use these two so We are having the events and first thing first I'm going to map our RSP detail with RP So within our event we are getting the recipe details and I'm going to use two recipe now it's time to use our use case so this is for deletion so I'm going to use a delete recipe use case and invoke it now I'm going to put my recipe within this invoke and ultimately I'm going to launch this thing in V model scope just like this we are having insertion logic So for that I'm going
to use insert recipe use case invoke it get my event recipe details convert this thing into a recipe and lastly launch it in V model scope and yeah it will done the insertion so yeah we are uh pretty much done with our view model now it's time to go our RP detail screen and try to fill this on detail and on favorite click in our icon button on favorite click. invoke and pass your Uh ree detail so this ree detail is ultimately coming from our UI State value do data so I'm going to check first
whether it is uh null or not so if it is not null then only I'm going to use this on click event and pass it here similarly just copy this thing and paste it here this is for the deletion so I'm going to use here on delete and yeah so all this event goes into our parent composable or you can say in navigation and within this uh we Are having on navigation click then we are having on favorite click and lastly we have on delete all right so apart from this we have to pass our
na host controller okay so for the deletion I'm going to use a view model on event event which is coming from uh ree details and here we are having the delete one over here now pass your ree detail similarly I'm going to use uh the favorite click on view model on event event that is Coming from our recie details and this will contain the insert recipe pass your recipe detail all right so when user click onto the navigation button I'm going to use view model on event and this time I'm using the event go to
the ree list screen all right so we are pretty much uh done with everything the insertion and and the deletion so now it's time to introduce our favorite screen so in order to do that go to this screen Package and within this I'm going to create a package naming favorite okay and within this favorite first I'm going to create its view model which is favorite view model this is a class and I'm going to use your Constructor injection pass my get all RPS from local database use case and make sure to extend this class with
view model and here I'm going to create an object naming favorite screen and Within this we are having our UI state so UI state is loading is a Boolean initially it's false next we are having error type is UI text and initial value would be RL and lastly we are having our actual data which is a list of Ree and initial value would be null now it's time to create uh events so we are having here SE interface event and within this so basically in this screen we are having sorting logic alphabetical sorting logic Then
we are having less ingredient sorting logic and lastly we are having drop down menu button which is actually used to reset these sorts so for that I'm having three different events so first event would be alphabetical sort use your event second one is our less ingredient sort use your event and lastly I'm going to use here reset sort we are having event okay so these three events we're going to use and one more thing if user click any of our recipe Item then we're going to show the details of that particular RSP item so for
that I'm going to use your data class naming so details and I'm going to pass the mail ID and lastly use the event okay so basically we having four events here now it's time to use uh the seal interface naming navigation so this is for the navigation and here we have only one navigation so for that I'm going to use here data class go To ree detail screen and pass the ID and simply extend this thing with navigation so we are having here our UI State our navigation and event now go to the view model
so first I'm going to create a variable naming UI state which is initialized with the help of mutable State flow initial value is UI State make sure this is coming from our favorite screen okay next is UI state which actually used to expose this thing So State flow type would be a UI State make sure this is coming from our favorite screen favorite model and I'm going to use here get use my top UI State and convert this as state flow so we are pretty much done with our UI test UI State now it's time
to create a function which actually get all the re list from our local database so I'm going to call this get RSP list and I'm going to use get all recipes from local database use case Invoke it so It ultimately gives back the list of recipes in the form of flow I'm going to use uh calculat test and in order to use this function we are going to use view model scope. launch all right now it's time to collect the latest recipes from our packen and update our UI state so I'm going to use here
UI State update and pass my UI state which is coming from our faity screen and in place of data This problem is actually happening because it is also receiving from this collect latest and also from this Lambda so I'm going to change its name from it to list and now I'm going to pass my list here within this data all right so yeah we are pretty much done so in the init block I'm going to use this get RSP list and convert this uh function to private function all right so we are done with this
and next thing I'm going to create a function on Event and pass my event make sure this event is coming from our favorite screen when event so Bas I'm going to use this suggestion so in order to perform sorting uh we are going to use one more variable on the top which actually hold our original list so for that I'm going to create here private while original list mutable list off and within this we are having our re PES so here I'm going to use my original List and update it with the help of list
to mutable list and change the original list from well to R so that it is a initializable all right so now I'm going to create three function for the alphabetical sort less ingredient sort and reset sort respectively so I'm going to create first function for the alphabetical sort and within this I'm going to use my UI State update use my original list and I'm going to use here sorted by with so We basically we are having alphabetical sort that means we are using our St Str males okay and this thing is actually wrapped within our
UI state so UI State uh make sure to use the faity screen one and in place of data I'm going to pass this all right so this is for our alphabetical sort similarly for the list ingredient so I'm going going to use here a UI State update my favorite screen UI State and within this data I'm going to use my original list and I'm Going to sort it by it. St strr ingredient length Okay so this is for our less ingredient sort and lastly I'm going to reset my sort so in order to do that
I'm going to use my original list and update my UI state so UI State update my favorite screen do its UI State and in place of data I'm going to pass my original list all right so this three is actually used for the Sorting so now I'm going to use this thing so in place of Alpha vertical sort I'm going to use this for the less ingredient sort I'm going to use less ingredient sort for the reset I'm going to use reset sort and lastly we are having so details so for showing the detail of
the particular recipe I'm going to create private variable naming navigation which is actually initialized with the help of Channel and the type would be navigation and make sure this navigation is coming From your favorite screen and remove this pair of parentheses with small brackets while a navigation type would be flow and this flow contains the type navigation which actually coming from our favorite screen all right now it's time to initialize this thing with navigation receive as flow so when our event is so detailed I'm going to use V model scope launch it and in the
navigation Channel I'm going to send the element so element would Coming from our uh favorite screen navigation. go to ree details and here we are receiving the ID all right so yeah we are done with our view model so now we are going to create our favorite screen so in the favorite package I'm going to create a file naming favorite screen and within this file I'm having a composable naming favorite screen and I'm going to use scaffold here and within this scaffold I'm having top Bar So within our top app bar I'm going to use
title naming favorite recipes and style is coming from our material theme typograph headline small and within this we are having actions and within this action I'm going to use icon button and this has an UI icon default more world so when user click onto this icon button we are going to show a drop down menu that contains our sort list all Right so in order to show the list I'm going to create a state for that so so drop down remember savable and within this we are having mutable state of false and second state is
for our selection so selected index is equivalent to remember savable mutable state of minus one so initially it's minus one remove this state saver because we are not going to use that thing and annotate our composable with experimental material 3 API now when user click onto this icon button I'm going to toggle my so drop down value so if our show dropdown value is true then I'm going to show my drop down menu and in place of expanded I'm going to pass my show drop down value and when on dismiss request will invoke then on
that occasion I'm going to toggle this so drop down menu again and within this I'm going to create my drop- down menu item so drop down menu Item in place of text I'm going to pass first is alphabetical and when user click onto this then first thing first I'm going to update my selected index value from minus1 to zero and after that I'm going to toggle my so drop down with value and lastly I'm going to use my view model events so in order to use view model event I'm going to pass my view model
and here we are having view model on event so event which is coming From our faity screen and here we are having alphabetical sort so send it all right so in place of leading I icon I'm going to use radio button so selection is depend onto our selected index value if it is zero that means it is check and on clicks things are pretty much same so simply copy paste it all right so this is for our alphabetical similarly we are having a less ingredient so I'm going to copy this paste it over here and
this time I'm Going to change this text from alphabet tile to less ingredient and I'm going to change the selected index value from 0 to 1 and alphabetical sort now become less ingredient sort similarly here change 0 to 1 and alphabetical sort become less ingredient sort now simply copy this and paste it over here this time I'm going to use reset so in place of selected value use two less ingredients now become reset sort selected value again become two and in Place of list ingredient sort use reset sort all right so we are pretty much
done with our drop- down menu now go to your scaffold content and here we are going to use our view model UI state so in order to use our view model UI State on the top I'm going to create a variable naming UI State and use my view model UI State and collect s State now in the content I'm going to check my UI State value if it is loading then I'm going to create a box having modifier Ping is coming from the content of this scaffold and lastly I'm going to use filmax size and
the content alignment will be on the center and within this we are having circular progress indicator so this is for the loading case second is our error case so UI State value error and if it is not equivalent to UI text. IDL then I'm going to create a box having modifier padding is coming from the content adding values Fil Max size and the content alignment will be on the center and this time I'm using text UI State value error get a string okay so lastly we are having our success state so UI text UI State
value and if our data is not null and I'm going to change the name from it to list okay so if our list is empty then the UI is pretty much same like error so I'm going to copy this paste it Over here and change the text from this two nothing found okay if it is not the case that means I'm going to use lazy column and this lazy column having modifier padding is coming from scaffold content padding values fil Max size now within this we are having items use this second one pass your list
and here you can pass your list item so I'm going to use the same list item that we were Using for our re list screen so go to yourp list screen and here we are having the list item this one so I'm going to Simply copy it paste it in my favorite screen so here we are uh getting an error of on click this is because we are not having on click in our composable as a parameter so let's do that so here I'm going to use uh on click and within this I'm going to
pass my mail ID go back to your list item and this Time it's fine okay so this is happening because we are not annotating our composable with experimental layout API to do it and within our card item I'm going to use box having modifier fill Max width and within this I'm going to put my async image and just below to our async image I'm going to create an icon button which is actually having modifier of modifier and its background color would be white and its shape is circle Sh all right and within this icon button
I'm going to create an icon which is icon do default. delete content description would be null and I'm going to change its color to color red all right so when user click onto this icon button I want to delete that recipe from our local datab base so in order to do that go to your favorite VI model and here I'm going to introduce and event so which is delete recipe and pass my recipe Here go to the top and add the remaining branches in our on event function so in order to delete the rest from
our local DB we have to add our use case so which is private while delete recipe use case now just below to our on event I'm going to create a private function naming delete recipe and within this I'm going to pass my recipe and I'm going to use my delete recipe use case invoke it pass my recipe and launch this thing in Our view model scope now I'm I'm going to use this function here delete recipe and pass my recipe all right so our is deleted from the local database now go back to your favorite
screen and here I'm going to use a view model on event event which is coming from our faity screen we are having delete recipe pass your recipe all right so we are successfully deleted and recipe item from our local database now what we happen if user click any of Our RSP item so we will navigate to the RP details and show the compete detail of that particular thing so in order to do that go to your favorite view model and here we need to add an event go to details and within this I'm going to
pass my ree ID use event here on the top add the remaining branches and this time and here I'm going to use model scope launch navigation send navigation make sure this navigation is Coming from our fav screen and within this we are having go to ree details and you can simply pass your ID from event all right so now go back to your favority screen and here on the top I'm going to use my navigation so in order to use our navigation we require life cycle owner local life cycle owner. current and I'm going to
use launch effect pass my view model navigation view model navigation flow with life cycle so I'm Going to use my life cycle honor. life cycle and collect the latest emission so it says navigation so when our navigation so we actually have only one branch for this so in order to perform navigation we require n host controller so after modifier I'm going to pass my nav host controller all right so this nav host controller is actually coming from our navigation so in the navigation we Don't have a route for our favority screen so go to your
SP detail and here we are having a lot of routes so simply use a data object naming favority screen and within this I'm having my navigation route slash favorite okay now come back to your navigation and here I'm going to create an composable navigation route faity screen. route and if it is a case then I'm going to use my favority screen and within this we have to pass Our nav host controller so pass your nav host controller second one is our view model so I'm going to create a view model here favorite view model pass
your view model lastly we are having on click and it gives me mail ID so I'm going to use my view model on event and pass my event make sure this is coming from our favorite screen and here we are having go to details and pass your mail ID uh yeah we are pretty much done with our composable now go back to your Favorite screen and here I'm going to use my nav host controller do navigate so we are having here navigation routes for our RSP details and use the send ID and we are getting
the ID from our navigation so yeah this is done for the navigation so we are pretty much done with our favorite screen now it's time to navigate to this screen from our resist screen so go to your resp list Screen and on the top we are having scaffold and within this scaold I'm going to create my floating action button and UI of this is uh actually have an icon which is star not start it star let me import this content description would be null and when anyone click onto this I'm going to perform the navigation
so you to perform navigation I'm going to introduce an Event here so so this time it's a data object favorite screen and it's an event go to the top add the remaining branches in your on event and I'm going to use view model scope do launch and ultimately send my navigation so in order to send the navigation we are going to create a navigation data object this time go to fa screen and it's a navigation go to the top and use this thing so navigation dot Go to favorite screen now come back to your rest
list screen add the remaining branches and use your nav host controller. navigate we are having here navigation route faity screen. route now it's time to execute our app all right so we are having a problem the problem is in search repor implementation we need to pass ree da so in order to pass ree Dow just use uh ree Dow here and pass it execute the app again all right so our app executed Successfully but when you click this floating acction button it didn't work so in the floating acction button on click I have not added
the event so view model on event we are having here event this is coming from our RP list and with this we are having go to favority screen all right now execute this thing again all right so when you click onto this Floating Action button ultimately our app crashes so This is because so our app crash this do this reason so actually I'm not adding this Hilt view model annotation on the top of our view model now execute your app again and now when i c click onto this floating ex button uh yes we are
going to our favorite recipes now go back and here I'm going to type chicken okay chicken Hy I'm going to open this detail and click on to this star Button all right come back and when you go to this favorite screen you you are seeing that uh the item is saved in our local DB but the thing is we are not uh want our delete icon over there I want this delete icon in this uh right corner but the thing is when I click onto this delete uh icon It ultimately deleted that means functionality right
it works now I'm going to add few more rest piece into our local DB now open my fil pce and here we are Having now it's time to see the Sorting things so alphabetically if I click here you can see alphabetically it is sorted like this we are having less ingredients and if you want to reset it you can do it all right so functionality wise everything works now I'm going to change this uh alignment from the left side to the right side so go back to your project and here in our for screen we
are having list Item over here so I'm going to use modifier within our icon button and I'm going to use align so alignment is actually to the end top of the end and after that I want pting of 12 DP execute this app again uh we have a problem here let me see the problem okay so actually I'm having the modifier already so I'm going to cut out the Align function from here and uh you know paste it over here now simply remove this Modifier from icon button and execute the app again all right so
go to favorite and here you can see we are having our delete icon on the right side but the thing is uh we are having a lot of padding so in order to reduce this padding again just cut out this thing and paste before our background now execute your app Okay click onto this floing button and yeah now it's looking fine all right so we are done with our favorite screen now it's time to create Our media player so for media player I have already created a separate module and we will proceed in this media
player module for our media player so in our media player I'm going to first create a few packages so first package is for the navigation and after that we are having our screens and lastly we are having dependency injection okay so first uh I'm going to add few dependencies in our media player Build. kts so here on the bottom I'm going to add implementation for the YouTube player so lips. youtube. video. player okay okay uh like this uh we are going to use dagger Hilt here so go to your search data layer and simply copy
this uh dependencies and come back to your media player b.g. GTS and simply paste it and on the top we need plugins so just copy this thing come back to your media Player go on to the top and paste your plugins all right and also we need navigation so for the navigation I'm going to use implementation lips do navigation. compose and I'm going to connect this module to the common module sync again all right so now I'm going in my dependency package and here I'm going to create media player module this is an object and
on the top we have installing Singleton component and this is a module so I'm going to write this thing with module okay and in the navigation I'm going to create a file naming navigation and within this navigation I'm going to create an interface naming media player feature API and this ultimately use our feature API which is present in our common module and just below to it I'm going to write its implementation ultimately it will use media player feature API I all right so I'm going to use my nav gra Builder and use its navigation here
we are having its route and start destination so go to your common module just control click onto this feature API Hit the Target and here we are having navigation route so in place of sub route I'm going to create uh media player sub route and route Would be mediacore player all right and in our navigation route I'm going to create here uh an data object naming media player ultimately it uses navigation route and I'm going to call this player/ the video uncore ID so this video uncore ID is actually coming from our RSP detail screen
and within this I'm want to Create a function naming send URL and pass my video ID in a form of string and it will ultimately return me the route so player/ video URL I remove this pair of parenthesis because we don't require this pair of parenthesis here yeah we are pretty much done here now go back to your media player and navigation and in place of route I'm going to use a Navigation subgraph route. media player. route and in the start destination I'm going to use navigation route. media player. route and I'm going to use
the composable uh route is coming from our navigation route do media player. route and now I'm going to create my composable so just click onto this Target and in the screen I'm going to create here media player screen this is a file And in this file I'm I'm having a composable naming media player screen and I'm receiving video ID within this composable okay and and within this I'm going to use Android view so first I'm going to use modifier fil Max uh size and we are having here factory so in Factory I'm going to use
a YouTube player View pass my context okay and I'm going to use here apply scope function and within this we have ADD YouTube player listener so I'm going to use it YouTube player listener and just click control I Implement everything all right so on the top we are having your life cycle honor use local life cycle honor. current and within the supply scope function I'm going to use my life cycle owner. life cycle and add the Observer all right so we are receiving video ID from the composable and in our on ready I'm going To
use my YouTube player and simply all the load video pass my video ID here and uh the starting seconds will be 0 f and remove this toos otherwise sometime it will crash your app all right so now it's time to use this media player screen in your navigation and here just paste it import this thing and I'm going to fetch out the media player video ID so it is coming from argument so it. argument get string we are having here uh video uncore ID Okay so if our media player video ID is not n then
only I'm going to use my media player screen here and pass my video ID in it all right so we are are pretty much done with our media player the media player feature API implementation now I'm going to use the dependency injection framework to provide this so provide function provide media player feature API so this is a function and the return Return type of this is Media Player feature API and I'm going to return its implementation which is media play here implementation all right so go back to your RSP detail screen and here on the
bottom you will see we have a text watch YouTube video so I'm going to write an if statement here and check whether my recipe details. St YouTube is not empty then only I will show this okay so when user click onto this I'm going to uh navigate from the resp Detail screen to the media player so in order to do that go to your resp detail view model and add an event so data class go to Media Player this is an event okay because it's a data class so we have to pass the YouTube url
go to the top and add the remaining branches so we are going to perform navigation so go to your navigation and within this we are having data class go to Media Player and we are going to pass The YouTube URL and uh it's a navigation all right so go to your events and here we are having go to Media Player event and within this I'm going to use my V model scope launch it and in the navigation Channel I'm going to send the navigation our recie details okay and uh we are having go to Media
Player so I'm going to use it and pass my event YouTube url all right so now go back to your uh Ree detail screen and in the text I'm going to use modifier clickable event and in the view model I'm going to pass my event so this event is coming from our res detail event and here we are having go to Media Player simply use your resp detail and pass your YouTube url all right so on the top of this screen we are having a launch effect and within this we are having navigation okay so
when it is a case of Go to Media Player then what we are going to do so first thing first I'm going to extract the video ID so this video ID is ultimately coming from our navigation YouTube URL and uh I'm going to use split operator here V question mark and I'm going to take the last of this list and I'm going to use nav host controller navigate from the navigation route I will choose media player and send the video ID so this video ID is coming from Here all right so this will ultimately perform
the navigation now go to the app module and here we are having uh navigation subgraphs so I'm going to add one more subgraph here which is uh media player API go to your app module and here we are going to pass media player as a parameter and use it all right so now go to your navigation and here we are having navigation subgraph media player API now Register this thing so we are having na host controller pass your na host controller and and in the place of nav gra Builder pass this all right so now
it's time to execute this app but before executing our app make sure to add the composable dependencies in your media player so to do that just right click any of the package and go to activity in the gallery create an empty compose activity simply finish it and once it's done you can delete this activity and Then after you can execute your app all right so I'm going to type here chicken and yeah here I'm having this recipe I'm going to click it and on the bottom I have watch YouTube video so when I click it
so here you can see this will play a YouTube video so we are done with our app uh we are done with every feature that uh we were discussed in the starting of the video all right so we are done with this video and in this video we have created A recipe search app which is full flet and performance wise it is well optimized now if you want to say something about this video you can comment it out and if you like this video then please click the like button apart from this subscribe to my
channel so that in future if I'm going to upload new videos you will get the notification bye