Slide 1

Slide 1 text

ANDROID TV APPLICATION Effie Barak (@CodingChick)

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Support libraries required Either Glide or Picasso can work, there are implementation differences

Slide 5

Slide 5 text

Which version of the support libraries to use? The latest one that works - All support libraries versions need to be the same. - SQLCipher needs to be 3.3.1-1or higher. Which didn’t work so well for me :(

Slide 6

Slide 6 text

Application Manifest Changes

Slide 7

Slide 7 text

Theme to play with

Slide 8

Slide 8 text

Tons of auto generated code!

Slide 9

Slide 9 text

Main page birdview

Slide 10

Slide 10 text

Main page birdview scrolling

Slide 11

Slide 11 text

Main Fragment that extends BrowseFragment: ArrayObjectAdapter ListRowPresenter ImageCardView

Slide 12

Slide 12 text

Hooking up Udemy’s model

Slide 13

Slide 13 text

Click events should use Course model

Slide 14

Slide 14 text

CourseCardPresenter extends Presenter (Is just your everyday adapter)

Slide 15

Slide 15 text

ImageCardView is provided by leanback • CARD_TYPE_INFO_OVER (1) • CARD_TYPE_INFO_UNDER (2) • CARD_TYPE_INFO_UNDER_WITH_EXTRA (3) • CARD_TYPE_MAIN_ONLY (0)

Slide 16

Slide 16 text

Course Details birdview

Slide 17

Slide 17 text

Course Details scrolled down

Slide 18

Slide 18 text

CourseDetailsFragment DetailsOverviewRowPresenter ClassPresenterSelector ListRowPresenter ImageCardView

Slide 19

Slide 19 text

DetailsOverviewRowPresenter is deprecated New class- FullWidthDetailsOverviewRowPresenter with different UI :(

Slide 20

Slide 20 text

LecturePresenter is similar to CoursePresenter

Slide 21

Slide 21 text

Details row gets its own Presenter

Slide 22

Slide 22 text

Creating the course details row

Slide 23

Slide 23 text

Creating the lectures row

Slide 24

Slide 24 text

Hooking it all up to the ClassPresenterSelector

Slide 25

Slide 25 text

Clicking on a lecture starts the Playback activity

Slide 26

Slide 26 text

Playback Activity

Slide 27

Slide 27 text

Playback Activity

Slide 28

Slide 28 text

Playback Activity

Slide 29

Slide 29 text

PlaybackOverlayFragment extends leanback’s PlaybackOverlayFragment ClassPresenterSelector DetailsOverviewRowPresenter ListRowPresenter

Slide 30

Slide 30 text

Instantiating the base structure

Slide 31

Slide 31 text

Adding all the ACTIONS Etc etc etc…

Slide 32

Slide 32 text

Hooking up the actions listeners

Slide 33

Slide 33 text

Video! Warp 9! Engage!

Slide 34

Slide 34 text

The VideoView plays things

Slide 35

Slide 35 text

Implementation of MediaSession

Slide 36

Slide 36 text

And the callbacks class

Slide 37

Slide 37 text

playPause method

Slide 38

Slide 38 text

The controls in the PlaybackControlsRow need to know.

Slide 39

Slide 39 text

The actions click events can invoke the MediaController’s methods

Slide 40

Slide 40 text

Voice search

Slide 41

Slide 41 text

Voice search

Slide 42

Slide 42 text

Searchinggg

Slide 43

Slide 43 text

In the Search Fragment

Slide 44

Slide 44 text

The actual search

Slide 45

Slide 45 text

Loading the results

Slide 46

Slide 46 text

Handling clicking on a result

Slide 47

Slide 47 text

Starting the whole thing up

Slide 48

Slide 48 text

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