1
00:00:04,300 --> 00:00:06,500
Welcome back, everyone. Okay.

2
00:00:06,750 --> 00:00:09,750
We're going to use the vector drawables in our menu.

3
00:00:10,450 --> 00:00:12,350
Right click the menu folder,

4
00:00:14,950 --> 00:00:17,950
and choose new, menu resource file.

5
00:00:20,650 --> 00:00:23,450
We want to add three menu items to the report

6
00:00:23,810 --> 00:00:25,010
then set their attributes.

7
00:00:25,560 --> 00:00:28,920
The first one will have the ID, menu_report,

8
00:00:31,520 --> 00:00:32,520
and click okay.

9
00:00:37,820 --> 00:00:41,220
We want to add three menu items to the report,

10
00:00:41,220 --> 00:00:42,520
then set their attributes. The

11
00:00:48,220 --> 00:00:50,220
first one will have the ID

12
00:00:53,320 --> 00:00:55,680
rm_filter

13
00:00:56,450 --> 00:00:57,650
_period.

14
00:00:58,550 --> 00:01:02,150
Create a new string resource for the title using the symbol.

15
00:01:06,810 --> 00:01:10,810
The resource name will be rm_title

16
00:01:12,410 --> 00:01:15,410
_filter_day,

17
00:01:16,110 --> 00:01:18,810
with the resource value, show day.

18
00:01:20,810 --> 00:01:24,110
This menu is going to toggle between showing a single day

19
00:01:24,360 --> 00:01:26,060
or showing the data for a week.

20
00:01:26,720 --> 00:01:29,720
We'll be changing the icon and text in our code,

21
00:01:30,420 --> 00:01:33,220
but it does mean we needed two text strings here.

22
00:01:33,720 --> 00:01:36,720
Rather than opening up the strings.xml file,

23
00:01:36,920 --> 00:01:40,020
I'll just repeat the process and create another resource.

24
00:01:45,220 --> 00:01:46,520
Click the symbol again,

25
00:01:50,320 --> 00:01:51,680
add a new resource.

26
00:01:52,670 --> 00:01:56,670
The resource name will be rm_title

27
00:01:56,970 --> 00:02:00,570
_filter_week.

28
00:02:02,370 --> 00:02:06,250
And the resource value will be show week.

29
00:02:10,449 --> 00:02:13,450
Use the symbol next to icon

30
00:02:15,250 --> 00:02:18,250
to choose ic_filter_7_black

31
00:02:19,450 --> 00:02:20,750
from the drawables. 

32
00:02:24,050 --> 00:02:26,050
The showAsAction attribute

33
00:02:27,040 --> 00:02:29,640
should be set to ifRoom.

34
00:02:30,840 --> 00:02:32,440
Okay, the second item.

35
00:02:36,440 --> 00:02:39,440
We'll have the ID rm_filter_date.

36
00:02:44,440 --> 00:02:45,440
The title

37
00:02:49,440 --> 00:02:50,340
will be

38
00:02:52,140 --> 00:02:56,640
rm_title_filter

39
00:02:58,240 --> 00:03:00,240
_date,

40
00:03:01,540 --> 00:03:05,640
and the value will be set report date.

41
00:03:10,840 --> 00:03:11,840
The icon

42
00:03:14,640 --> 00:03:17,640
will be ic_date_range

43
00:03:20,000 --> 00:03:22,360
_black_24dp,

44
00:03:25,240 --> 00:03:28,900
and the showAsAction again will be ifRoom.

45
00:03:31,300 --> 00:03:32,800
Our third item

46
00:03:38,600 --> 00:03:41,600
will be rm_delete.

47
00:03:44,900 --> 00:03:46,500
It'll have a string resource

48
00:03:48,000 --> 00:03:51,000
of rm_title

49
00:03:52,000 --> 00:03:54,700
_delete with the value delete

50
00:03:55,950 --> 00:03:58,250
old timings.

51
00:04:02,250 --> 00:04:03,250
Its icon

52
00:04:06,610 --> 00:04:11,210
will be ic_delete_black_24dp.

53
00:04:14,540 --> 00:04:17,540
And for this button, the showAsAction

54
00:04:17,740 --> 00:04:20,240
will be CollapseActionView.

55
00:04:22,240 --> 00:04:25,120
We could use ifRoom for this one as well,

56
00:04:25,120 --> 00:04:27,920
but this option probably won't be used very often.

57
00:04:28,520 --> 00:04:32,520
For that reason, I don't want it to always appear on the toolbar.

58
00:04:33,400 --> 00:04:35,600
There won't be room in portrait in any case.

59
00:04:35,960 --> 00:04:39,060
So I'll keep it hidden behind the settings menu icon

60
00:04:39,060 --> 00:04:40,560
when in landscape as well.

61
00:04:42,220 --> 00:04:44,220
This setting does a bit more than that.

62
00:04:44,720 --> 00:04:46,720
If there is room to display the item,

63
00:04:47,160 --> 00:04:49,460
it will always appear with its text

64
00:04:49,460 --> 00:04:52,820
even if we specified an icon as we have here.

65
00:04:53,620 --> 00:04:57,120
That means the text will be visible on very large screens.

66
00:04:57,620 --> 00:05:00,820
I think that's a good thing for something destructive like this.

67
00:05:01,370 --> 00:05:05,170
It means the users are less likely to click it to see what it does. 

68
00:05:06,160 --> 00:05:10,520
We'll be providing a cancel option, and we'll also ask for confirmation,

69
00:05:11,020 --> 00:05:14,620
but it's still a good idea to keep users away from this option

70
00:05:14,620 --> 00:05:17,720
until they know definitely that they want to use it.

71
00:05:18,620 --> 00:05:21,420
So that's the menu finished. In the next video,

72
00:05:21,420 --> 00:05:25,520
we'll write the code to display the menu and respond to the user tapping it.

73
00:05:26,120 --> 00:05:27,120
See you then.

