Good day, everyone. Welcome back. In this video,
we'll make some changes to main activity.
I'll start with the DeprecatedViewModelProviders.
And of course, we'll fix the import.
In the OnRestoreInstanceState function,
the bundle is declared as nullable type.
If you've generated the overridden function more recently,
you may not have that.
But my stub was generated a while ago
before Google added the nullable and non-null annotations.
So we remove the question mark.
In the RemoveEditPane function,
we left some old code commented out for reference,
that can be deleted now.
There's also a CommentedOut function called
on line 127.
And we've got a complete copy of the ShowAboutDialogue function
starting on line 183.
Working down the file,
there's some old code in TaskEdit request that can be deleted.
And there's another comment on line 201.
Finally, we overrode a load function of the lifecycle methods
just to see them being called in the logcat.
We should delete them because they're not doing anything useful.
I don't want to delete them just yet though.
We're going to make some more changes and they could be useful for debugging.
I will add a to-do comment
so that I don't forget to delete them before releasing the app.
I've put the note about the OnStop function in there but humans make mistakes.
It would be safer to move that function to before the to do
so that we don't inadvertently delete it.
There are some unused constants in a couple of the contract classes.
They should be deleted.
And in the DurationsContract class,
in main activity fragment
we'll fix the problem with the DeprecatedViewModel providers.
Of course, we also fix the import.
We've also got a load of Redundant
Lifecycle functions at the end of main activity fragment.
I won't delete them yet in case we get problems with the remaining code changes.
Once again though, I'll add a to-do comment
so that I don't forget to delete them before releasing the app.
We're dealing with UnusedLifeCycle functions,
so we don't need onActivityCreated,
up on line 61.
We've got enough other logging in functions that are doing something,
so I'll delete this one.
A full code review would be far more intense than this.
You'd go through each class and discuss the purpose and implementation
of each of the functions.
That would take hours at this stage in our app's development.
Normally, you'd have a code review far more frequently
when there are only a small number of classes to review.
But we've tidied up our code and we're ready to work on improving the app.
At least, we were ready.
While we were working on this section for the course,
Google released a few changes to the androidx libraries.
We'll have a quick look at them in the next video. I'll see you there.