use of com.aspsine.irecyclerview.universaladapter.ViewHolderHelper in project AndroidNews by zhjohow.
the class MultiItemAblistViewAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (mMultiItemTypeSupport == null)
return super.getView(position, convertView, parent);
int layoutId = mMultiItemTypeSupport.getLayoutId(position, getItem(position));
ViewHolderHelper viewHolder = ViewHolderHelper.get(mContext, convertView, parent, layoutId, position);
convert(viewHolder, getItem(position));
return viewHolder.getConvertView();
}
use of com.aspsine.irecyclerview.universaladapter.ViewHolderHelper in project AndroidNews by zhjohow.
the class CommonRecycleViewAdapter method onCreateViewHolder.
@Override
public ViewHolderHelper onCreateViewHolder(final ViewGroup parent, int viewType) {
ViewHolderHelper viewHolder = ViewHolderHelper.get(mContext, null, parent, mLayoutId, -1);
setListener(parent, viewHolder, viewType);
return viewHolder;
}
use of com.aspsine.irecyclerview.universaladapter.ViewHolderHelper in project AndroidNews by zhjohow.
the class CommonAblistViewAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolderHelper holder = ViewHolderHelper.get(mContext, convertView, parent, layoutId, position);
convert(holder, getItem(position));
return holder.getConvertView();
}
use of com.aspsine.irecyclerview.universaladapter.ViewHolderHelper in project AndroidNews by zhjohow.
the class MultiItemRecycleViewAdapter method onCreateViewHolder.
@Override
public ViewHolderHelper onCreateViewHolder(ViewGroup parent, int viewType) {
if (mMultiItemTypeSupport == null)
return super.onCreateViewHolder(parent, viewType);
int layoutId = mMultiItemTypeSupport.getLayoutId(viewType);
ViewHolderHelper holder = ViewHolderHelper.get(mContext, null, parent, layoutId, -1);
setListener(parent, holder, viewType);
return holder;
}
use of com.aspsine.irecyclerview.universaladapter.ViewHolderHelper in project AndroidNews by zhjohow.
the class VideosFragment method initView.
@Override
protected void initView() {
if (getArguments() != null) {
mVideoType = getArguments().getString(AppConstant.VIDEO_TYPE);
}
irc.setLayoutManager(new LinearLayoutManager(getContext()));
videoListAdapter = new CommonRecycleViewAdapter<VideoData>(getContext(), R.layout.item_video_list) {
@Override
public void convert(ViewHolderHelper helper, VideoData videoData) {
helper.setImageRoundUrl(R.id.iv_logo, videoData.getTopicImg());
helper.setText(R.id.tv_from, videoData.getTopicName());
helper.setText(R.id.tv_play_time, String.format(getResources().getString(R.string.video_play_times), String.valueOf(videoData.getPlayCount())));
JCVideoPlayerStandard jcVideoPlayerStandard = helper.getView(R.id.videoplayer);
boolean setUp = jcVideoPlayerStandard.setUp(videoData.getMp4_url(), JCVideoPlayer.SCREEN_LAYOUT_LIST, TextUtils.isEmpty(videoData.getDescription()) ? videoData.getTitle() + "" : videoData.getDescription());
if (setUp) {
Glide.with(mContext).load(videoData.getCover()).diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().error(com.zhjh.common.R.drawable.ic_empty_picture).crossFade().into(jcVideoPlayerStandard.thumbImageView);
}
}
};
irc.setAdapter(videoListAdapter);
irc.setOnRefreshListener(this);
irc.setOnLoadMoreListener(this);
// 视频监听
irc.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(View view) {
}
@Override
public void onChildViewDetachedFromWindow(View view) {
if (JCVideoPlayerManager.listener() != null) {
JCVideoPlayer videoPlayer = (JCVideoPlayer) JCVideoPlayerManager.listener();
if (((ViewGroup) view).indexOfChild(videoPlayer) != -1 && videoPlayer.currentState == JCVideoPlayer.CURRENT_STATE_PLAYING) {
JCVideoPlayer.releaseAllVideos();
}
}
}
});
// 数据为空才重新发起请求
if (videoListAdapter.getSize() <= 0) {
// 发起请求
mStartPage = 0;
mPresenter.getVideosListDataRequest(mVideoType, mStartPage);
}
}
Aggregations