Android TV

Bcc14b45a86f42cd22d9102a96bc8a5c?s=47 Effie Barak
March 20, 2016
100

Android TV

I gave this talk in DroidCon SF 2016

Bcc14b45a86f42cd22d9102a96bc8a5c?s=128

Effie Barak

March 20, 2016
Tweet

Transcript

  1. DEVELOPING FOR ANDROID TV Effie Barak (@CodingChick)

  2. Outline 1. What is familiar in developing for the TV

    2. What is different (Leanback)
  3. So what is the same?

  4. None
  5. Basic structure

  6. Code written for mobile

  7. Support libraries required Either Glide or Picasso can work, there

    are implementation differences
  8. Libraries libraries - All support libraries versions need to be

    the same. - SQLCipher needs to be 3.3.1-1or higher. Android means all of our favorite libraries just work!
  9. Application Manifest Changes

  10. UI differences and Leanback

  11. Leanback main UI elements: Presenter - Leanback's version of a

    Recycler Adapter, has onBindViewHolder method and a ViewHolder. Not position-based. PresenterSelector - If there's more then one or more types of Presenters displayed in the same view ArrayObjectAdapter- A generic array that contains everything else.
  12. Browse page

  13. The UI elements in Browse ArrayObjectAdapter ListRowPresenter ImageCardView

  14. MainActivity MainFragment CourseCardPresenter Presenter BrowseFragment Contains Extends Uses Classes Involved

    in Browse
  15. UI structure with Udemy Courses

  16. Hooking up Listeners

  17. CourseCardPresenter extends Presenter (Is just your everyday adapter)

  18. The ViewHolder contains ImageCardView

  19. Course Details

  20. The UI elements in Course Details DetailsOverviewRowPresenter ClassPresenterSelector ListRowPresenter ImageCardView

  21. LectureCardPresenter DetailsActivity CourseDetailsFragment DetailsFragment CourseDetailsDescription Presenter AbstractDetailsDescription Presenter Presenter Contains

    Extends Uses Classes in Details View
  22. DetailsOverviewRowPresenter is deprecated New class- FullWidthDetailsOverviewRowPresenter with different UI :(

  23. Details row gets its own Presenter

  24. Adding Actions to the CourseDetailsRow

  25. LecturePresenter is similar to CoursePresenter

  26. Hooking it all up to the ClassPresenterSelector

  27. Playing a video

  28. The UI elements in Playback VideoVideo

  29. The UI elements in Playback ClassPresenterSelector PlaybackControlsRow ListRowPresenter

  30. Interaction between the Fragment and the Activity Remote control actions

    PlaybackOverlayActivity PlaybackOverlayFragment Actions on controls Row VideoView Callbacks:
  31. Setting up VideoView

  32. The VideoView plays things

  33. Implementation of MediaSession

  34. And the callbacks class

  35. playPause method

  36. The Actions in the Fragment

  37. Hooking up the actions listeners

  38. The actions click listeners invoke the MediaController’s methods

  39. The controls in the PlaybackControlsRow need to know.

  40. Voice search

  41. Voice search

  42. Searching

  43. Getting the search query

  44. Loading the results

  45. Useful resources: https://github.com/googlesamples/androidtv-Leanback Default auto-generated template https://developer.android.com/training/tv/index.html (Sorta, kinda, maybe)

  46. Thank you!

  47. UI Testing