From 27412be889d0a58a93fd20d40d40ff22afe4990c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 15 八月 2020 17:39:24 +0800 Subject: [PATCH] '视频详情页面完善' --- BuWanVideo/src/com/weikou/beibeivideo/ui/video/EpisodeNewAdapter.java | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/ui/video/EpisodeNewAdapter.java b/BuWanVideo/src/com/weikou/beibeivideo/ui/video/EpisodeNewAdapter.java index 9869d78..d1af15d 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/ui/video/EpisodeNewAdapter.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/ui/video/EpisodeNewAdapter.java @@ -28,15 +28,22 @@ private LayoutInflater layoutInflater; private Context mContext; + private ISelectVideoEpisodeListener selectVideoEpisodeListener; + private int displayType; - public EpisodeNewAdapter(Context context, VideoInfo videoInfo, int displayType, int playingPosition) { + public EpisodeNewAdapter(Context context, VideoInfo videoInfo, int displayType, int playingPosition, ISelectVideoEpisodeListener selectVideoEpisodeListener) { this.videoInfo = videoInfo; this.playingPosition = playingPosition; layoutInflater = LayoutInflater.from(context); this.mContext = context; this.displayType = displayType; + this.selectVideoEpisodeListener = selectVideoEpisodeListener; + } + + public void setPlayingPosition(int position){ + this.playingPosition = position; } @NonNull @@ -58,7 +65,7 @@ @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) { final VideoDetailInfo info = videoInfo.getVideoDetailList().get(position); EpisodeViewHolder viewHolder = (EpisodeViewHolder) holder; setDisplaySize(viewHolder.tv_episode); @@ -71,6 +78,14 @@ } viewHolder.tv_episode.setText(info.getTag()); + viewHolder.tv_episode.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (selectVideoEpisodeListener != null) + selectVideoEpisodeListener.onClick(position, info); + } + }); + } @Override @@ -90,4 +105,9 @@ } } + + public interface ISelectVideoEpisodeListener { + public void onClick(int position, VideoDetailInfo detailInfo); + } + } -- Gitblit v1.8.0