English subtitles

← Quick Code Overview

Get Embed Code
4 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. Let's take a quick look
    at the layout of the app.
  2. Here are the Java classes.
  3. The Dinner class has methods for
    figuring out what dinner to suggest.
  4. The MainActivity shows the main screen.
  5. To start with the main screen only has
    this one button, What's for dinner?
  6. And when you press the button
    it fires off an intent
  7. to the show dinner activity.
  8. So the dinner shows here and
    then you get these buttons.
  9. And each of these buttons fires off
    an intent to start the appropriate
  10. activity.
  11. So for example,
  12. the Show Recipe button sends an intent
    to start the show recipe activity.
  13. And actually, Choose Again does
    not have a corresponding activity,
  14. it just has a method inside the class.
  15. Now this class here,
    the useInfoBoxFragment
  16. is a fragment that simply displays
    an info box and a heading.
  17. This lets you reuse the fragment
    wherever you need it, and
  18. helps simplify the code.
  19. And for example, the showRecipeActivity,
    the removeMealActivity,
  20. the orderDinnerActivity,
    all these activities use this fragment.
  21. And the app has a couple of menus.
  22. There's the main menu,
    which just shows the settings.
  23. But actually, we're not going to use
    the settings in this application.
  24. More interestingly, the food prefs menu,
    displays a list of food options.
  25. This pop-up is used whenever we want
    the user, choose the food preference.
  26. There's one other quick
    thing I want to mention.
  27. In the intro lesson to this
    course you learned how to
  28. implement the unconnected code to
    use the Google API Client Library.
  29. However, for both Google Analytics and
    Google Tag Manager,
  30. you do not need to implement any code
    to use the Google API Client Library.
  31. All the app needs is to specify
    the version of the client library
  32. in the android manifest, like this.
  33. And to specify the dependency on
    play-services in the build.gradle file.
  34. And these dependencies have already
    been set up for you in the What's For
  35. Dinner sample app.