1 00:00:00,340 --> 00:00:04,570 We, just finished hooking up our next image button and our color button. 2 00:00:04,570 --> 00:00:08,830 Now let's finish up the app, by hooking up all the buttons on the overflow menu. 3 00:00:08,830 --> 00:00:11,928 Let's start by adding a case for when the red button is clicked. 4 00:00:11,928 --> 00:00:15,677 Case R.id.red, and 5 00:00:15,677 --> 00:00:19,630 add a break statement. 6 00:00:21,340 --> 00:00:24,986 Then inside the case, let's toggle the value of our red variable, 7 00:00:24,986 --> 00:00:29,880 red = not red. 8 00:00:29,880 --> 00:00:31,470 And then, call the updateColors method. 9 00:00:33,640 --> 00:00:37,450 Lastly, since our checkboxes don't do anything themselves, 10 00:00:37,450 --> 00:00:39,870 we need to manually update them. 11 00:00:39,870 --> 00:00:44,195 So let's call item, which remember refers to our red menu 12 00:00:44,195 --> 00:00:51,570 item.setChecked and pass in red to make it match the underlying variable. 13 00:00:53,150 --> 00:00:53,930 Awesome! 14 00:00:53,930 --> 00:00:58,107 Now that we've got red taken care of, let's copy and paste this block two times. 15 00:01:03,023 --> 00:01:05,261 And then, let's make this one for green. 16 00:01:11,748 --> 00:01:13,297 And, this one for blue. 17 00:01:19,462 --> 00:01:23,832 Finally, all that's left is the reset button. 18 00:01:23,832 --> 00:01:30,359 Let's add one more case, for R.id.reset. 19 00:01:30,359 --> 00:01:31,690 And, let's add our break statement. 20 00:01:33,410 --> 00:01:36,050 And then, to reset the image to its initial state, 21 00:01:37,200 --> 00:01:42,019 we just need to call Imageview.clearColorFilter. 22 00:01:43,520 --> 00:01:47,110 We should also reset our red, green, blue, and 23 00:01:47,110 --> 00:01:52,570 color variables to all be true, which we can do on one line, like this. 24 00:01:52,570 --> 00:01:59,483 Red = green = blue = color = true. 25 00:01:59,483 --> 00:02:03,680 Lastly, since we've made changes to these variables, 26 00:02:03,680 --> 00:02:05,640 we should also update the options menu. 27 00:02:06,790 --> 00:02:11,310 So, let's add a call to invalidate options menu, and that should do it. 28 00:02:11,310 --> 00:02:13,270 We're ready to test the app. 29 00:02:13,270 --> 00:02:14,085 Let's run it. 30 00:02:18,953 --> 00:02:22,475 And then if we click on one of our check boxes, 31 00:02:22,475 --> 00:02:27,317 it removes that color from the image and the box is unchecked. 32 00:02:27,317 --> 00:02:28,870 Awesome. 33 00:02:28,870 --> 00:02:32,320 And if we click on the reset button after clicking a few check boxes, 34 00:02:33,500 --> 00:02:37,760 the image goes back to normal and the boxes get rechecked. 35 00:02:37,760 --> 00:02:38,910 Perfect. 36 00:02:38,910 --> 00:02:41,420 Great job putting together this options menu. 37 00:02:41,420 --> 00:02:43,590 If you'd like to learn more about options menus, 38 00:02:43,590 --> 00:02:45,800 check out the links in the Teacher's notes below. 39 00:02:45,800 --> 00:02:49,048 And as always, if you have any questions or would like to try your hand 40 00:02:49,048 --> 00:02:52,804 at answering other people's questions, make your way over to the community. 41 00:02:52,804 --> 00:02:53,618 Until next time.