android.support.v17.leanback.widget.PlaybackControlsRowPresenter Java Examples

The following examples show how to use android.support.v17.leanback.widget.PlaybackControlsRowPresenter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaPlayerGlue.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreateControlsRowAndPresenter() {
    super.onCreateControlsRowAndPresenter();
    PlaybackControlsRowPresenter presenter = (PlaybackControlsRowPresenter)
            getPlaybackRowPresenter();
    presenter.setProgressColor(getContext().getResources().getColor(
            R.color.player_progress_color));
    presenter.setBackgroundColor(getContext().getResources().getColor(
            R.color.player_background_color));
}
 
Example #2
Source File: PlaybackOverlaySupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void resetControlsToPrimaryActions(ItemBridgeAdapter.ViewHolder vh) {
    if (vh == null && getVerticalGridView() != null) {
        vh = (ItemBridgeAdapter.ViewHolder) getVerticalGridView().findViewHolderForPosition(0);
    }
    if (vh == null) {
        mResetControlsToPrimaryActionsPending = true;
    } else if (vh.getPresenter() instanceof PlaybackControlsRowPresenter) {
        mResetControlsToPrimaryActionsPending = false;
        ((PlaybackControlsRowPresenter) vh.getPresenter()).showPrimaryActions(
                (PlaybackControlsRowPresenter.ViewHolder) vh.getViewHolder());
    }
}
 
Example #3
Source File: PlaybackOverlaySupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void loadDescriptionAnimator() {
    AnimatorUpdateListener listener = new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            if (getVerticalGridView() == null) {
                return;
            }
            ItemBridgeAdapter.ViewHolder adapterVh = (ItemBridgeAdapter.ViewHolder)
                    getVerticalGridView().findViewHolderForPosition(0);
            if (adapterVh != null && adapterVh.getViewHolder()
                    instanceof PlaybackControlsRowPresenter.ViewHolder) {
                final Presenter.ViewHolder vh = ((PlaybackControlsRowPresenter.ViewHolder)
                        adapterVh.getViewHolder()).mDescriptionViewHolder;
                if (vh != null) {
                    vh.view.setAlpha((Float) arg0.getAnimatedValue());
                }
            }
        }
    };

    mDescriptionFadeInAnimator = loadAnimator(
            getActivity(), R.animator.lb_playback_description_fade_in);
    mDescriptionFadeInAnimator.addUpdateListener(listener);
    mDescriptionFadeInAnimator.setInterpolator(mLogDecelerateInterpolator);

    mDescriptionFadeOutAnimator = loadAnimator(
            getActivity(), R.animator.lb_playback_description_fade_out);
    mDescriptionFadeOutAnimator.addUpdateListener(listener);
}
 
Example #4
Source File: PlaybackOverlaySupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void updateControlsBottomSpace(ItemBridgeAdapter.ViewHolder vh) {
    // Add extra space between rows 0 and 1
    if (vh == null && getVerticalGridView() != null) {
        vh = (ItemBridgeAdapter.ViewHolder)
                getVerticalGridView().findViewHolderForPosition(0);
    }
    if (vh != null && vh.getPresenter() instanceof PlaybackControlsRowPresenter) {
        final int adapterSize = getAdapter() == null ? 0 : getAdapter().size();
        ((PlaybackControlsRowPresenter) vh.getPresenter()).showBottomSpace(
                (PlaybackControlsRowPresenter.ViewHolder) vh.getViewHolder(),
                adapterSize > 1);
    }
}
 
Example #5
Source File: PlaybackOverlaySupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
public void onDetachedFromWindow(ItemBridgeAdapter.ViewHolder vh) {
    if (DEBUG) Log.v(TAG, "onDetachedFromWindow " + vh.getViewHolder().view);
    // Reset animation state
    vh.getViewHolder().view.setAlpha(1f);
    vh.getViewHolder().view.setTranslationY(0);
    if (vh.getViewHolder() instanceof PlaybackControlsRowPresenter.ViewHolder) {
        Presenter.ViewHolder descriptionVh = ((PlaybackControlsRowPresenter.ViewHolder)
                vh.getViewHolder()).mDescriptionViewHolder;
        if (descriptionVh != null) {
            descriptionVh.view.setAlpha(1f);
        }
    }
}
 
Example #6
Source File: PlaybackOverlayFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void resetControlsToPrimaryActions(ItemBridgeAdapter.ViewHolder vh) {
    if (vh == null && getVerticalGridView() != null) {
        vh = (ItemBridgeAdapter.ViewHolder) getVerticalGridView().findViewHolderForPosition(0);
    }
    if (vh == null) {
        mResetControlsToPrimaryActionsPending = true;
    } else if (vh.getPresenter() instanceof PlaybackControlsRowPresenter) {
        mResetControlsToPrimaryActionsPending = false;
        ((PlaybackControlsRowPresenter) vh.getPresenter()).showPrimaryActions(
                (PlaybackControlsRowPresenter.ViewHolder) vh.getViewHolder());
    }
}
 
Example #7
Source File: PlaybackOverlayFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void loadDescriptionAnimator() {
    AnimatorUpdateListener listener = new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            if (getVerticalGridView() == null) {
                return;
            }
            ItemBridgeAdapter.ViewHolder adapterVh = (ItemBridgeAdapter.ViewHolder)
                    getVerticalGridView().findViewHolderForPosition(0);
            if (adapterVh != null && adapterVh.getViewHolder()
                    instanceof PlaybackControlsRowPresenter.ViewHolder) {
                final Presenter.ViewHolder vh = ((PlaybackControlsRowPresenter.ViewHolder)
                        adapterVh.getViewHolder()).mDescriptionViewHolder;
                if (vh != null) {
                    vh.view.setAlpha((Float) arg0.getAnimatedValue());
                }
            }
        }
    };

    mDescriptionFadeInAnimator = loadAnimator(
            getActivity(), R.animator.lb_playback_description_fade_in);
    mDescriptionFadeInAnimator.addUpdateListener(listener);
    mDescriptionFadeInAnimator.setInterpolator(mLogDecelerateInterpolator);

    mDescriptionFadeOutAnimator = loadAnimator(
            getActivity(), R.animator.lb_playback_description_fade_out);
    mDescriptionFadeOutAnimator.addUpdateListener(listener);
}
 
Example #8
Source File: PlaybackOverlayFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void updateControlsBottomSpace(ItemBridgeAdapter.ViewHolder vh) {
    // Add extra space between rows 0 and 1
    if (vh == null && getVerticalGridView() != null) {
        vh = (ItemBridgeAdapter.ViewHolder)
                getVerticalGridView().findViewHolderForPosition(0);
    }
    if (vh != null && vh.getPresenter() instanceof PlaybackControlsRowPresenter) {
        final int adapterSize = getAdapter() == null ? 0 : getAdapter().size();
        ((PlaybackControlsRowPresenter) vh.getPresenter()).showBottomSpace(
                (PlaybackControlsRowPresenter.ViewHolder) vh.getViewHolder(),
                adapterSize > 1);
    }
}
 
Example #9
Source File: PlaybackOverlayFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
public void onDetachedFromWindow(ItemBridgeAdapter.ViewHolder vh) {
    if (DEBUG) Log.v(TAG, "onDetachedFromWindow " + vh.getViewHolder().view);
    // Reset animation state
    vh.getViewHolder().view.setAlpha(1f);
    vh.getViewHolder().view.setTranslationY(0);
    if (vh.getViewHolder() instanceof PlaybackControlsRowPresenter.ViewHolder) {
        Presenter.ViewHolder descriptionVh = ((PlaybackControlsRowPresenter.ViewHolder)
                vh.getViewHolder()).mDescriptionViewHolder;
        if (descriptionVh != null) {
            descriptionVh.view.setAlpha(1f);
        }
    }
}