| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.yeshi.buwanshequ.R; |
| | | import com.weikou.beibeivideo.R; |
| | | |
| | | public class EpisodeNewAdapter extends RecyclerView.Adapter { |
| | | |
| | |
| | | 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 |
| | |
| | | |
| | | @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); |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public interface ISelectVideoEpisodeListener { |
| | | public void onClick(int position, VideoDetailInfo detailInfo); |
| | | } |
| | | |
| | | } |