1
00:00:05,200 --> 00:00:08,200
Good day, everyone. Welcome back. In this video,

2
00:00:08,200 --> 00:00:10,400
we'll make some changes to main activity.

3
00:00:11,200 --> 00:00:14,200
I'll start with the DeprecatedViewModelProviders.

4
00:00:24,600 --> 00:00:26,400
And of course, we'll fix the import.

5
00:00:34,900 --> 00:00:37,900
In the OnRestoreInstanceState function,

6
00:00:41,100 --> 00:00:43,700
the bundle is declared as nullable type.

7
00:00:44,600 --> 00:00:47,850
If you've generated the overridden function more recently,

8
00:00:47,850 --> 00:00:49,050
you may not have that.

9
00:00:49,550 --> 00:00:51,910
But my stub was generated a while ago

10
00:00:51,910 --> 00:00:55,910
before Google added the nullable and non-null annotations.

11
00:00:59,570 --> 00:01:01,170
So we remove the question mark.

12
00:01:01,530 --> 00:01:04,530
In the RemoveEditPane function,

13
00:01:07,890 --> 00:01:10,760
we left some old code commented out for reference,

14
00:01:11,310 --> 00:01:12,710
that can be deleted now.

15
00:01:18,370 --> 00:01:21,030
There's also a CommentedOut function called

16
00:01:21,030 --> 00:01:22,610
on line 127.

17
00:01:29,380 --> 00:01:33,780
And we've got a complete copy of the ShowAboutDialogue function

18
00:01:33,780 --> 00:01:36,080
starting on line 183.

19
00:01:45,070 --> 00:01:46,430
Working down the file,

20
00:01:46,430 --> 00:01:50,310
there's some old code in TaskEdit request that can be deleted.

21
00:01:55,210 --> 00:01:58,810
And there's another comment on line 201.

22
00:02:02,010 --> 00:02:06,560
Finally, we overrode a load function of the lifecycle methods

23
00:02:06,560 --> 00:02:08,860
just to see them being called in the logcat.

24
00:02:09,460 --> 00:02:12,450
We should delete them because they're not doing anything useful.

25
00:02:13,250 --> 00:02:15,250
I don't want to delete them just yet though.

26
00:02:15,250 --> 00:02:19,150
We're going to make some more changes and they could be useful for debugging.

27
00:02:19,850 --> 00:02:21,950
I will add a to-do comment

28
00:02:21,950 --> 00:02:24,950
so that I don't forget to delete them before releasing the app.

29
00:02:56,750 --> 00:03:01,150
I've put the note about the OnStop function in there but humans make mistakes.

30
00:03:01,550 --> 00:03:05,350
It would be safer to move that function to before the to do

31
00:03:05,710 --> 00:03:07,910
so that we don't inadvertently delete it.

32
00:03:25,010 --> 00:03:29,110
There are some unused constants in a couple of the contract classes.

33
00:03:29,410 --> 00:03:30,660
They should be deleted.

34
00:03:39,210 --> 00:03:41,610
And in the DurationsContract class,

35
00:03:46,710 --> 00:03:48,510
in main activity fragment

36
00:03:51,710 --> 00:03:55,510
we'll fix the problem with the DeprecatedViewModel providers.

37
00:04:09,010 --> 00:04:10,670
Of course, we also fix the import.

38
00:04:11,170 --> 00:04:13,420
We've also got a load of Redundant

39
00:04:13,420 --> 00:04:16,720
Lifecycle functions at the end of main activity fragment.

40
00:04:17,320 --> 00:04:21,920
I won't delete them yet in case we get problems with the remaining code changes.

41
00:04:22,220 --> 00:04:25,220
Once again though, I'll add a to-do comment

42
00:04:25,220 --> 00:04:28,520
so that I don't forget to delete them before releasing the app.

43
00:04:48,520 --> 00:04:51,520
We're dealing with UnusedLifeCycle functions,

44
00:04:51,520 --> 00:04:54,020
so we don't need onActivityCreated,

45
00:04:57,020 --> 00:04:58,520
up on line 61.

46
00:05:05,080 --> 00:05:08,980
We've got enough other logging in functions that are doing something,

47
00:05:08,980 --> 00:05:10,480
so I'll delete this one.

48
00:05:10,730 --> 00:05:13,730
A full code review would be far more intense than this.

49
00:05:14,230 --> 00:05:18,330
You'd go through each class and discuss the purpose and implementation

50
00:05:18,330 --> 00:05:19,630
of each of the functions. 

51
00:05:20,130 --> 00:05:23,130
That would take hours at this stage in our app's development.

52
00:05:23,730 --> 00:05:26,630
Normally, you'd have a code review far more frequently

53
00:05:26,630 --> 00:05:29,510
when there are only a small number of classes to review.

54
00:05:30,170 --> 00:05:34,570
But we've tidied up our code and we're ready to work on improving the app.

55
00:05:35,170 --> 00:05:36,770
At least, we were ready.

56
00:05:37,870 --> 00:05:40,470
While we were working on this section for the course,

57
00:05:40,470 --> 00:05:43,470
Google released a few changes to the androidx libraries.

58
00:05:44,030 --> 00:05:47,830
We'll have a quick look at them in the next video. I'll see you there.

