Search in sources :

Example 1 with VideoViewHolder

use of com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder in project VideoPlayerManager by danylovolokh.

the class BaseVideoItem method createView.

public View createView(ViewGroup parent, int screenWidth) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.video_item, parent, false);
    ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    layoutParams.height = screenWidth;
    final VideoViewHolder videoViewHolder = new VideoViewHolder(view);
    view.setTag(videoViewHolder);
    videoViewHolder.mPlayer.addMediaPlayerListener(new MediaPlayerWrapper.MainThreadMediaPlayerListener() {

        @Override
        public void onVideoSizeChangedMainThread(int width, int height) {
        }

        @Override
        public void onVideoPreparedMainThread() {
            // When video is prepared it's about to start playback. So we hide the cover
            videoViewHolder.mCover.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onVideoCompletionMainThread() {
        }

        @Override
        public void onErrorMainThread(int what, int extra) {
        }

        @Override
        public void onBufferingUpdateMainThread(int percent) {
        }

        @Override
        public void onVideoStoppedMainThread() {
            // Show the cover when video stopped
            videoViewHolder.mCover.setVisibility(View.VISIBLE);
        }
    });
    return view;
}
Also used : ViewGroup(android.view.ViewGroup) MediaPlayerWrapper(com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) VideoViewHolder(com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder)

Example 2 with VideoViewHolder

use of com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder in project VideoPlayerManager by danylovolokh.

the class BaseVideoItem method setVisibilityPercentsText.

private void setVisibilityPercentsText(View currentView, int percents) {
    if (SHOW_LOGS)
        Logger.v(TAG, "setVisibilityPercentsText percents " + percents);
    VideoViewHolder videoViewHolder = (VideoViewHolder) currentView.getTag();
    String percentsText = "Visibility percents: " + String.valueOf(percents);
    videoViewHolder.mVisibilityPercents.setText(percentsText);
}
Also used : VideoViewHolder(com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder)

Example 3 with VideoViewHolder

use of com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder in project VideoPlayerManager by danylovolokh.

the class VideoRecyclerViewAdapter method onCreateViewHolder.

@Override
public VideoViewHolder onCreateViewHolder(ViewGroup viewGroup, int position) {
    BaseVideoItem videoItem = mList.get(position);
    View resultView = videoItem.createView(viewGroup, mContext.getResources().getDisplayMetrics().widthPixels);
    return new VideoViewHolder(resultView);
}
Also used : BaseVideoItem(com.volokh.danylo.videolist.video_list_demo.adapter.items.BaseVideoItem) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) VideoViewHolder(com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder)

Example 4 with VideoViewHolder

use of com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder in project VideoPlayerManager by danylovolokh.

the class BaseVideoItem method setActive.

/**
     * When this item becomes active we start playback on the video in this item
     */
@Override
public void setActive(View newActiveView, int newActiveViewPosition) {
    VideoViewHolder viewHolder = (VideoViewHolder) newActiveView.getTag();
    playNewVideo(new CurrentItemMetaData(newActiveViewPosition, newActiveView), viewHolder.mPlayer, mVideoPlayerManager);
}
Also used : CurrentItemMetaData(com.volokh.danylo.video_player_manager.meta.CurrentItemMetaData) VideoViewHolder(com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder)

Aggregations

VideoViewHolder (com.volokh.danylo.videolist.video_list_demo.adapter.holders.VideoViewHolder)4 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 ViewGroup (android.view.ViewGroup)1 CurrentItemMetaData (com.volokh.danylo.video_player_manager.meta.CurrentItemMetaData)1 MediaPlayerWrapper (com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper)1 BaseVideoItem (com.volokh.danylo.videolist.video_list_demo.adapter.items.BaseVideoItem)1