Alright, so I've re synced the project,
and rebuilt it just to make sure everything's okay.
And you can see that I'm now running
the latest version of Kotlin.
I'm no longer getting any warnings here
that there's a new version so I'm actually,
I've got the latest version.
In the case of this update, the new update of Kotlin,
I've updated the link checks amongst other things
and certainly well worth updating the versions of Kotlin.
And quite well as they come out with the updates.
Alright so this videos gonna be a quick one.
We've gotta couple of small corrections to make.
First one, is I'm going to open the code
and we're going to open the add edit fragment class.
Okay, a bit more space there
and there's a small correction.
And the correction's actually in the comment,
which has confused a few people.
And it's because I made a typo.
So down here on line 59, that should have actually
read "We're not editing an existing one."
and I put and editing an existing one
So that should be and not.
Put it in uppercase to emphasise it.
Editing another thing, so the complete line
no task, so we must be adding a new task
and not editing an existing one.
Alright the second correction is a result
of switching between Java and Kotlin.
What I've done is I've used stream concatenation
in the un-attach function.
So if we go down and check that out.
It's down here towards the end on line
there it is, on line 129.
And you can see there's a warning there on line 129.
Convert concatenation to template.
And into our studio, we'll actually offer to fix that.
So if you come over here, click in there,
move over to the locked light bulb,
convert concatenation to template option to change that
I click on that and its measured in now a more Kotlin
style syntext with a dollar context.
Instead of using stream concatenation.
Alright, so that's something we need to make
two changes we need to make to edited fragment.
If you open up app provider, the Kotlin class,
we'll see that there's quite a few warnings showing there.
Now the first couple, we look at those,
they're relating to the fact that we're not using
those constants yet.
And specifically that's the code on line 29 and 30.
You can see towards the bottom of the screen.
I'm going to ignore those warnings.
That's because we're gonna be using those
two constants soon in future videos.
But, if we scroll down and look
at some of these other warnings,
first ones actually line 43 I think
from memory, you can see over here that's actually
introducing a warning, redundant semicolon.
So I'm going to actually remove that.
There's also another one on line 48.
That just removes a few of the warnings.
Now, all the remaining warnings should be because
the get context function should return now.
We just look up one of those now.
Now, we're not calling the function,
we're using Kotlin's ability to access it as a property.
But the net results the same.
The light bulb can help in this scenario.
What we want is this first option.
We go over to bring up the light bulb,
I'll go down a little bit so you can see.
The actual code.
We'll go into that warning, first one.
So I click in there and check the light bulb.
This first option here, inspect nullability mismatched
based on Java annotations.
I'm gonna check that, or I'm going to click that rather.
Then the one we actually want is to select this option here.
The first one, suppress that the nullability
mismatch based on Java annotations for the entire class.
So for class app provider.
So I click on that, you should
see all those warnings disappear.
Which they have, and if we go back up to the top
of the class, we'll see that it's just added
an annotation to the top of the class.
It's added that line 34.
As you can see there now.
Now is it safe to do what I've just done?
Well, yes it is or I wouldn't have done it.
Now if we actually control click on the context.
Or command click, if your on a Mac.
And I'll go down to context again.
And then to here and I'll do a control click there.
And that's gone into the Java source code
for content provider.
Now the doc stream for the get context method there
is actually telling us, or explaining that it's only
available once Oncreate has been called.
You can see that on line 712.
So if we try to get the context before then, we'll get null.
But in our scenario, with our code, we're not doing that.
Because all the places in our provider where we're
getting our context, are definitely after Oncreate.
So therefore it's definitely safe to suppress the warning.
As you saw me do.
Alright, so I'm gonna close down that now.
So, that's a bit of tidying up
and checking your Kotlin version
is something you want to do whenever Andriod Studio
updates that Kotlin plag-ing because you'll find those
new warnings that perhaps weren't there in older versions.
Alright, so let's end the video here.
And in the net one, we'll continue on with the adapter
for our recycler view.
See you in the next video.