leanback/src/main/java/androidx/leanback/app/DetailsSupportFragmentBackgroundController.java
public void enableParallax(@NonNull Drawable coverDrawable, @NonNull Drawable bottomDrawable,
                               @Nullable ParallaxTarget.PropertyValuesHolderTarget
                                       coverDrawableParallaxTarget) {
        if (mParallaxDrawable != null) {
            return;
        }
        // if bitmap is set before enableParallax, use it as initial value.
        if (mCoverBitmap != null && coverDrawable instanceof FitWidthBitmapDrawable) {
            ((FitWidthBitmapDrawable) coverDrawable).setBitmap(mCoverBitmap);
        }
        // if solid color is set before enableParallax, use it as initial value.
        if (mSolidColor != Color.TRANSPARENT && bottomDrawable instanceof ColorDrawable) {
            ((ColorDrawable) bottomDrawable).setColor(mSolidColor);
        }
        if (mPlaybackGlue != null) {
            throw new IllegalStateException("enableParallaxDrawable must be called before "
                    + "enableVideoPlayback");
        }
        mParallaxDrawable = new DetailsParallaxDrawable(
                mFragment.getContext(),
                mFragment.getParallax(),
                coverDrawable,
                bottomDrawable,
                coverDrawableParallaxTarget);
        mFragment.setBackgroundDrawable(mParallaxDrawable);
        // create a VideoHelper with null PlaybackGlue for changing CoverDrawable visibility
        // before PlaybackGlue is ready.
        mVideoHelper = new DetailsBackgroundVideoHelper(null,
                mFragment.getParallax(), mParallaxDrawable.getCoverDrawable());
    }
/**
     * Enables parallax background using a custom cover drawable at top and a custom bottom
     * drawable. This method must be called before {@link #setupVideoPlayback(PlaybackGlue)}.
     *
     * @param coverDrawable Custom cover drawable shown at top. {@link #setCoverBitmap(Bitmap)}
     *                      will not work if coverDrawable is not {@link FitWidthBitmapDrawable};
     *                      in that case it's app's responsibility to set content into
     *                      coverDrawable.
     * @param bottomDrawable Drawable shown at bottom. {@link #setSolidColor(int)} will not work
     *                       if bottomDrawable is not {@link ColorDrawable}; in that case it's app's
     *                       responsibility to set content of bottomDrawable.
     * @param coverDrawableParallaxTarget Target to perform parallax effect within coverDrawable.
     *                                    Use null for no parallax movement effect.
     *                                    Example to move bitmap within FitWidthBitmapDrawable:
     *                                    new ParallaxTarget.PropertyValuesHolderTarget(
     *                                        coverDrawable, PropertyValuesHolder.ofInt(
     *                                            FitWidthBitmapDrawable.PROPERTY_VERTICAL_OFFSET,
     *                                            0, -120))
     * @throws IllegalStateException If {@link #setupVideoPlayback(PlaybackGlue)} was called.
     */
Enables parallax background using a custom cover drawable at top and a custom bottom
drawable. This method must be called before  #setupVideoPlayback(PlaybackGlue).

@param coverDrawable Custom cover drawable shown at top.  #setCoverBitmap(Bitmap)
will not work if coverDrawable is not  FitWidthBitmapDrawable;
in that case it's app's responsibility to set content into
coverDrawable.
@param bottomDrawable Drawable shown at bottom.  #setSolidColor(int) will not work
if bottomDrawable is not  ColorDrawable; in that case it's app's
responsibility to set content of bottomDrawable.
@param coverDrawableParallaxTarget Target to perform parallax effect within coverDrawable.
Use null for no parallax movement effect.
Enables parallax background using a custom cover drawable at top and a custom bottom drawable . This method must be called before #setupVideoPlayback ( PlaybackGlue ) . @param coverDrawable Custom cover drawable shown at top . #setCoverBitmap ( Bitmap ) will not work if coverDrawable is not FitWidthBitmapDrawable ; in that case it ' s app ' s responsibility to set content into coverDrawable . @param bottomDrawable Drawable shown at bottom . #setSolidColor ( int ) will not work if bottomDrawable is not ColorDrawable ; in that case it ' s app ' s responsibility to set content of bottomDrawable . @param coverDrawableParallaxTarget Target to perform parallax effect within coverDrawable . Use null for no parallax movement effect .
public void enableParallax(@NonNull Drawable coverDrawable, @NonNull Drawable bottomDrawable,
                               @Nullable ParallaxTarget.PropertyValuesHolderTarget
                                       coverDrawableParallaxTarget) {
        if (mParallaxDrawable != null) {
            return;
        }
        if (mCoverBitmap != null && coverDrawable instanceof FitWidthBitmapDrawable) {
            ((FitWidthBitmapDrawable) coverDrawable).setBitmap(mCoverBitmap);
        }
        if (mSolidColor != Color.TRANSPARENT && bottomDrawable instanceof ColorDrawable) {
            ((ColorDrawable) bottomDrawable).setColor(mSolidColor);
        }
        if (mPlaybackGlue != null) {
            throw new IllegalStateException("enableParallaxDrawable must be called before "
                    + "enableVideoPlayback");
        }
        mParallaxDrawable = new DetailsParallaxDrawable(
                mFragment.getContext(),
                mFragment.getParallax(),
                coverDrawable,
                bottomDrawable,
                coverDrawableParallaxTarget);
        mFragment.setBackgroundDrawable(mParallaxDrawable);
        mVideoHelper = new DetailsBackgroundVideoHelper(null,
                mFragment.getParallax(), mParallaxDrawable.getCoverDrawable());
    }
public void enableParallax ( @ NonNull Drawable coverDrawable , @ NonNull Drawable bottomDrawable , @ Nullable ParallaxTarget . PropertyValuesHolderTarget coverDrawableParallaxTarget ) { if ( mParallaxDrawable != null ) { return ; } if ( mCoverBitmap != null && coverDrawable instanceof FitWidthBitmapDrawable ) { ( ( FitWidthBitmapDrawable ) coverDrawable ) . setBitmap ( mCoverBitmap ) ; } if ( mSolidColor != Color . TRANSPARENT && bottomDrawable instanceof ColorDrawable ) { ( ( ColorDrawable ) bottomDrawable ) . setColor ( mSolidColor ) ; } if ( mPlaybackGlue != null ) { throw new IllegalStateException ( "enableParallaxDrawable must be called before " + "enableVideoPlayback" ) ; } mParallaxDrawable = new DetailsParallaxDrawable ( mFragment . getContext ( ) , mFragment . getParallax ( ) , coverDrawable , bottomDrawable , coverDrawableParallaxTarget ) ; mFragment . setBackgroundDrawable ( mParallaxDrawable ) ; mVideoHelper = new DetailsBackgroundVideoHelper ( null , mFragment . getParallax ( ) , mParallaxDrawable . getCoverDrawable ( ) ) ; }
Enables parallax background using a custom cover drawable at top and a custom bottom
 drawable.
Enables parallax background using a custom cover drawable at top and a custom bottom drawable .
// if bitmap is set before enableParallax, use it as initial value. // if solid color is set before enableParallax, use it as initial value. // create a VideoHelper with null PlaybackGlue for changing CoverDrawable visibility // before PlaybackGlue is ready.