leanback: make Details embedded video more useful
The current implementation has assumption that
the PlaybackGlue is setup during onCreate() and there
is only one PlaybackGlue allowed. The restriction
makes some use cases impossible. This CL address this
by adding more flexibility of when a PlaybackGlue can
be assigned to DetailsFragmentBackgroundController.
1. allow setupVideoPlayback() later, this allows
app add a purchase flow before playing.
2. allow setupVideoPlayback() multiple times, so
a real video can replace trailer video after
purchase flow is done.
3. Fix bug of RecyclerViewParallax not running
parallax effect when there is no item, added
a onLayoutChangeListener so that DetailsParallaxDrawable
will set correct bounds when RecyclerView is assigned
a initial size (verified by test noInitialItem)
4. new API canNavigateToVideoFragment(), this allows
app to control when DPAD_UP can navigate to videos.
5. new API switchToVideo() so that app can switch to video
UI programmatically after a purchase flow finishes.
Bug: 36126851
Test: DetailsFragmentTest DetailsSupportFragmentTest
Change-Id: I7cd4084e71b85d8fd739d30a421746312bdb086c
10 files changed