| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.util.glide.GlideRoundTransform; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.qq.e.ads.nativ.NativeADEventListener; |
| | | import com.qq.e.ads.nativ.NativeUnifiedADData; |
| | | import com.qq.e.ads.nativ.widget.NativeAdContainer; |
| | |
| | | if (StringUtils.isBlank(pic)) |
| | | pic = info.getPicture(); |
| | | |
| | | Glide.with(mContext).load(pic).transition(withCrossFade()).placeholder(R.color.black).into(albumVideoHolder.iv_picture); |
| | | |
| | | |
| | | albumVideoHolder.rl_picture.setTag(pic); |
| | | albumVideoHolder.rl_picture.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Glide.with(mContext).load(albumVideoHolder.rl_picture.getTag() + "").apply(new RequestOptions().centerCrop()).transition(withCrossFade()).transform(new GlideRoundTransform(mContext, 6)).placeholder(R.drawable.shape_video_list_cover_placeholder).into(albumVideoHolder.iv_picture); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | //设置分数 |
| | | if (!StringUtils.isEmpty(videoContent.getVideo().getScore())) { |
| | | albumVideoHolder.tv_score.setVisibility(View.VISIBLE); |
| | | String st = "评分:" + videoContent.getVideo().getScore(); |
| | | String st = "评分:" + videoContent.getVideo().getScore()+" "; |
| | | SpannableString spannableString = new SpannableString(st); |
| | | spannableString.setSpan(new AbsoluteSizeSpan(DimenUtils.spToPixels(13, mContext)), 3, st.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); |
| | | spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#FF9C00")), 3, st.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); |
| | |
| | | } else if (holder instanceof SimpleVideoHolder) { |
| | | final VideoInfo info = videoContent.getVideo(); |
| | | SimpleVideoHolder simpleVideoHolder = (SimpleVideoHolder) holder; |
| | | simpleVideoHolder.rl_picture.setTag(info.getPicture()); |
| | | simpleVideoHolder.rl_picture.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Glide.with(mContext).load(info.getPicture()).transition(withCrossFade()).placeholder(R.color.black).into(simpleVideoHolder.iv_movie_cover); |
| | | Glide.with(mContext).load(simpleVideoHolder.rl_picture.getTag() + "").apply(new RequestOptions().centerCrop()).transition(withCrossFade()).transform(new GlideRoundTransform(mContext, 6)).placeholder(R.drawable.shape_video_list_cover_placeholder).into(simpleVideoHolder.iv_movie_cover); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | simpleVideoHolder.tv_movie_title.setText(info.getName() + ""); |
| | | |
| | | if (info.getFree() == 1) { |
| | |
| | | if (videoContent.getAd().getGdt2Unfied() != null) { |
| | | NativeUnifiedADData ad = videoContent.getAd().getGdt2Unfied(); |
| | | |
| | | Glide.with(mContext).load(ad.getImgUrl()).transition(withCrossFade()).placeholder(R.drawable.shape_video_list_cover_placeholder).into(viewHolder.iv_picture); |
| | | |
| | | viewHolder.rl_picture.setTag(ad.getImgUrl()); |
| | | viewHolder.rl_picture.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Glide.with(mContext).load(viewHolder.rl_picture.getTag() + "").apply(new RequestOptions().centerCrop()).transition(withCrossFade()).transform(new GlideRoundTransform(mContext, 6)).placeholder(R.drawable.shape_video_list_cover_placeholder).into(viewHolder.iv_picture); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | viewHolder.tv_name.setText(ad.getTitle()); |
| | | viewHolder.tv_actors.setText(ad.getDesc()); |
| | | |
| | |
| | | TextView tv_play; |
| | | View view; |
| | | NativeAdContainer mNativeAdContainer; |
| | | RatioLayout rl_picture; |
| | | |
| | | public VideoAdHolder(View view) { |
| | | super(view); |
| | |
| | | tv_actors = view.findViewById(R.id.tv_actors); |
| | | tv_play = view.findViewById(R.id.tv_play); |
| | | mNativeAdContainer = view.findViewById(R.id.root); |
| | | |
| | | rl_picture = view.findViewById(R.id.rl_picture); |
| | | } |
| | | } |
| | | |
| | |
| | | FrameLayout ll_nav; |
| | | TextView tv_video_1, tv_video_2, tv_video_3, tv_video_4, tv_video_5; |
| | | View view; |
| | | RatioLayout rl_picture; |
| | | |
| | | public AlbumVideoHolder(View view) { |
| | | super(view); |
| | |
| | | tv_nav_more = view.findViewById(R.id.tv_nav_more); |
| | | tv_score = view.findViewById(R.id.tv_score); |
| | | tv_director = view.findViewById(R.id.tv_director); |
| | | rl_picture = view.findViewById(R.id.rl_picture); |
| | | } |
| | | } |
| | | |
| | | class SimpleVideoHolder extends RecyclerView.ViewHolder { |
| | | ImageView iv_movie_cover; |
| | | ImageView iv_vip; |
| | | RatioLayout rl_picture; |
| | | |
| | | TextView tv_movie_title, tv_tag; |
| | | View view; |
| | |
| | | tv_movie_title = view.findViewById(R.id.tv_movie_title); |
| | | tv_tag = view.findViewById(R.id.tv_tag); |
| | | iv_vip = view.findViewById(R.id.iv_vip); |
| | | rl_picture = view.findViewById(R.id.rl_picture); |
| | | } |
| | | } |
| | | |