History log of /frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3bcad88cbf4488e747d84893c35f2351b8f84afe 21-Mar-2017 Dake Gu <dake@google.com> leanback: new transport controls

PlaybackTransportRowPresenter is the new UX.

PlaybackTransportControlGlue extends from PlaybackGlue.
PlaybackTransportControlGlue is backed by PlayerWrapper.
PlaybackWrapper wraps underlying media player,
concrete example: MediaPlayerWrapper.

PlaybackSeekDataProvider defines the data interface that app
provides to leanback.
PlaybackUI defines seeking interaction between
PlaybackTransportControlGlue, PlaybackGlueHost and the presenter.

more:
- added progress bar support for media loading.
- fixed vertical video proportion and support video size change.

Test: PlaybackTransportControlGlueTest
PlaybackTransportRowPresenterTest.
Updated SampleVideoFragment.

Bug: 33751556

Change-Id: I1d39c6f65d04121f8cb9c25fb7ce103e32355190
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
89097f67f988ebba714a95e10369665280db0c27 25-Mar-2017 Dake Gu <dake@google.com> DetailsFragment: support switchToVideo in onCreate

Allows DetailsFragment to be put in intial video mode
and skip entrance transition and enter transition.

The DetailsFragment's state model is fairly complicated
including entrance transition, enter transition and
switchToVideo call. So reworked StateMachine and based
DetailsFragment on StateMachine, remove the PF_ flags used
before.

When switchToVideo is called in DetailsFragment.onCreate,
there is no video fragment yet, but we still fade out
cover drawable and create a pending flag once the video
fragment view is created will focus on to it.

Added support in GridLayoutManager to allow slideOut() when
there is no child, and layout the first pass out of
window.

switchToVideo is not allowed with entrance transition.
once prepareEntranceTransition is called, switchToVideo will
be ignored until entrance transition is finished. On the other
hand, calling prepareEntranceTransition after switchToVideo
will be ignored.

switchToVideo will clear activity enter transitions. Once
it is called in onCreate, we do not want the activity enter
transition to run.

Test: bunch of new tests in DetailsFragmentTest for all kinds
of scenarios
Bug: 36126851

Change-Id: Ic0279331b12b1e285507dffda3ad351245c01a1b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
f87eb1d84dfee2f1be9ea326754829b1eff4967f 22-Mar-2017 Dake Gu <dake@google.com> 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
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
bf4318c67254bc11307796601b9fb4a8bbfe67b2 21-Feb-2017 Dake Gu <dake@google.com> Parallax: API factorying and add direct mapping

Remove six classes from api file: Parallax.IntParallax,
Parallax.FloatParallax Parallax.IntPropertyMarkerValue,
Parallax.FloatPropertyMarkerValue, ParallaxEffect.IntEffect
parallaxEffect.FloatEffect.

Remove methods Parallax.verifyProperties ParallaxTarget.getFraction
from API file

The standard parallax mapping converts value of source
into 0~1 fraction then convert it back to target value.
This is not only inefficient but also causing rounding errors.
Added a concept of ParallaxTarget.isDirectMapping(). When
true, ParallaxEffect bypass the fraction calcuation and directly
passes value from source Property to
ParallaxTarget.updateValue(Number).

Now DetailsFragment uses direct mapping for changing
child drawable's bound.

Fix the bug that ValuesRule's type is unmodifiable.

Bug: 35933446
Bug: 32022097
Bug: 35632609
Test: DetailsFragmentTest.parallaxTest
ParallaxIntEffectTest.testDirectMapping
CompositeDrawableTest

Change-Id: Ibd89ba6621fc0804ea24cba099b6d2e6bf3fccc9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
3961cea270f51c29433a7eb21ec5f8c9ca7bd7d7 13-Feb-2017 Dake Gu <dake@google.com> MeidaPlayerGlue: Fix unable to play music, ...

... Playback state loss problem in Activity.onStop, and
leaking in enableProgressUpdate.

1. MediaPlayerGlue enableProgressUpdate() does not remove
previous Runnable, causing a leak.

2. MediaPlayerGlue.setMediaSource() does not call
prepareMediaForPlaying() and the prepare is relying on
SurfaceCreated being called. So it fails to play music.

3. onSurfaceDestroy/onSurfaceCreate should not reset player
which causing state loss in activity onStop().

Test: MediaPlayerGlueTest
Bug: 35318285 35246768 35319588

Change-Id: I254630c47199b813c13904787795ee8d4d896bd4
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
01f4dd4a9bc3b80d3ddecc0264facbf6abfc1cc3 07-Feb-2017 Dake Gu <dake@google.com> DetailsFragment: coordinate transition and PlaybackGlue

1. Exclude SurfaceView from transition because
it's quite a big hit on performance and unknown consequence
if we force the color format to be RGBA8888.
Disabled setTransitionVisibility() which causes
visual flickering even view is not running
transition. We will see the SurfaceView disappears
immediately after activity return transition is finished.

2. DetailsFragment will postpone setHost on PlaybackGlue until
all three conditions satisfied:
- onStart() is called
- activity enter transition is finished
- entrance transition is finished
It is tricky to query if enter transition will run. We did
this by checking if there is enter transition started after
200ms of data loading.

3. When DetailsFragment execute return transition:
- call DetailsBackgroundVideoHelper.disableParallax()
to avoid auto-play video when detailsFrame is
running a slide transition to bottom.
- if video is not playing: immediately remove VideoFragment
so we wont see a dark SurfaceView during return transition.
- if video is playing: Let the Video continue playing when
running return transition. (Because it's much better to
pops out VideoFragment at end than in the middle of running
transition).

4. removed 1 sec CROSSFADE_DELAY between play() and fade out
background drawable, this seems unnecessary after we have
the onPlaybackReady() callback.

Bug: 32987665
Test: leanback tests (and there is no way to test activity transition
in ActivityTestRule)

Change-Id: I2ecee0276aa6ffc7963b92cd2104bb1ca62b01cd
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java
e1cde4d4ac42a6e9e16aad2b4df970c7c7d0771c 21-Dec-2016 Dake Gu <dake@google.com> Leanback: parallax and details video API refactoring

There are too many new concpets introduced when we create
multiple building blocks around parallax. This CL tries to
get rid of some classes.

1. Remove class ParallaxSource, integrated into Parallax.
So there is no more setSource()/getSource().

2. Replace DetailsParallaxManager with DetailsParallax. It is no
longer a manager pattern but DetailsParallax is a direct
subclass of Parallax.

3. Replace DetailsBackgroundParallaxHelper with
DetailsParallaxDrawable which is a direct subclass of
CompositeDrawble. No more helper concept.

4. remove the glue creation API from DetailsFragment, those
are not necessary and app can do it on the side.

The summary of new classes:
1. Parallax, tracks multiple UI events and perform multiple
ParallaxEffects on ParallaxTargets. RecyclerViewParallax is a
subclass of Parallax that monitors RecyclerView child positions.

2. DetailsParallax is a subclass of RecyclerViewParallax,
DetailsFragment holds the DetailsParallax object and is responsible
to attach it to VerticalGridView and sync with Transition animation.
DetailsParallax is shared by both background bitmap and video.

3. Created a DetailsFragmentBackgroundController class responsible
for parallax background and embedded video playing.

Bug: 33750080
Bug: 33751156
Test: all existing leanback tests

Change-Id: Iec81a444d5d4fbeb675f16222b09b407acf007a2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundVideoHelper.java