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;
}
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);
}
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);
}
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);
}
Aggregations