| | |
| | | private final static int TYPE_HEADER = 10001; |
| | | private final static int TYPE_FOOTER = 10002; |
| | | |
| | | private String from; |
| | | |
| | | |
| | | public void setHeaderView(View headerView) { |
| | | this.headerView = headerView; |
| | |
| | | this.columns = columns; |
| | | } |
| | | |
| | | public VideoColumn2Adapter(final Activity activity, Context context, List<VideoInfo> videoList, boolean needAd, int columns, IVideoClickListener itemClickListener) { |
| | | this(activity, context, videoList, needAd, columns, itemClickListener, null); |
| | | public VideoColumn2Adapter(final Activity activity, Context context, List<VideoInfo> videoList, boolean needAd, int columns, String from, IVideoClickListener itemClickListener) { |
| | | this(activity, context, videoList, needAd, columns, from, itemClickListener, null); |
| | | } |
| | | |
| | | |
| | | public VideoColumn2Adapter(final Activity activity, Context context, List<VideoInfo> videoList, boolean needAd, int columns, IVideoClickListener itemClickListener, ExpressAdManager.IAdShowListener showListener) { |
| | | public VideoColumn2Adapter(final Activity activity, Context context, List<VideoInfo> videoList, boolean needAd, int columns, String from, IVideoClickListener itemClickListener, ExpressAdManager.IAdShowListener showListener) { |
| | | if (activity == null || context == null) |
| | | return; |
| | | this.mContext = context; |
| | |
| | | this.itemClickListener = itemClickListener; |
| | | this.columns = columns; |
| | | this.showListener = showListener; |
| | | this.from = from; |
| | | |
| | | for (VideoInfo video : videoList) { |
| | | contentList.add(VideoContent.createVideoContent(video)); |
| | |
| | | void addAdToPosition(int position, ExpressAdContainer ad) { |
| | | if (position >= 0 && position < contentList.size() && ad != null) { |
| | | contentList.add(position, VideoContent.createAdContent(ad)); |
| | | notifyItemInserted(position); |
| | | notifyItemRangeChanged(0, contentList.size()); |
| | | notifyDataSetChanged(); |
| | | // notifyItemInserted(position); |
| | | // notifyItemRangeChanged(0, contentList.size()); |
| | | if (showListener != null) |
| | | showListener.show(); |
| | | |
| | |
| | | private void myClick(VideoInfo info, final View v) { |
| | | Intent intent = new Intent(v.getContext(), VideoDetailActivity2.class); |
| | | intent.putExtra("video_info", info); |
| | | intent.putExtra("from", from); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | v.getContext().startActivity(intent); |
| | | } |