| | |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.support.v7.widget.LinearLayoutManager; |
| | | import android.support.v7.widget.RecyclerView; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.socialize.ShareAction; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.UMShareListener; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.entity.VideoResource; |
| | | import com.weikou.beibeivideo.entity.ad.ExpressAdContainer; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.weikou.beibeivideo.ui.video.EpisodeNewAdapter; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | import com.weikou.beibeivideo.util.ad.ExpressAdManager; |
| | | import com.weikou.beibeivideo.util.ui.DividerItemDecoration; |
| | | import com.yeshi.buwanshequ.R; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | private int mEnd; |
| | | private int mPlayingPosition; |
| | | private VideoInfo mVideoInfo = null; |
| | | private static GridView gv_episode; |
| | | private static EpisodeAdapter episodeAdapter; |
| | | private static EpisodeAdapter2 episodeAdapter2; |
| | | private static RecyclerView rv_episode; |
| | | |
| | | private TextView tv_add_to_favourite; |
| | | private LinearLayout fl_add_to_favourite; |
| | | private LinearLayout fl_report; |
| | | private ImageView iv_report; |
| | | private ImageView iv_favourite; |
| | | |
| | | private TextView tv_offline_cache; |
| | | |
| | | private LinearLayout fl_offline_cache; |
| | | |
| | | private ImageView iv_moive_img; |
| | | |
| | | private TextView tv_star_name, tv_update_time, tv_cancle_follow; |
| | | private TextView tv_star_name, tv_update_time, tv_cancle_follow, tv_video_resource, tv_title, tv_score, tv_play_num; |
| | | |
| | | private LinearLayout ll_add_attention; |
| | | |
| | | private FrameLayout fl_native_ad1; |
| | | |
| | | private EpisodeNewAdapter episodeAdapter; |
| | | |
| | | public static DisplayImageOptions option = new DisplayImageOptions.Builder() |
| | | .showImageForEmptyUri(R.drawable.from_other) |
| | |
| | | return R.layout.fragment_episode; |
| | | } |
| | | |
| | | |
| | | private void setVideoInfo() { |
| | | if (mVideoInfo == null) |
| | | return; |
| | | tv_title.setText(mVideoInfo.getName()); |
| | | if (!StringUtils.isBlank(mVideoInfo.getScore())) { |
| | | tv_score.setText("评分:" + mVideoInfo.getScore()); |
| | | tv_score.setVisibility(View.VISIBLE); |
| | | } else { |
| | | tv_score.setVisibility(View.GONE); |
| | | } |
| | | tv_play_num.setText("播放:" + VideoUtil.getWatchCountShortName(mVideoInfo.getWatchCount())); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | EventBus.getDefault().register(this); |
| | |
| | | mStart = getArguments().getInt("start"); |
| | | mEnd = getArguments().getInt("end"); |
| | | |
| | | ll_add_attention = (LinearLayout) contentView.findViewById(R.id.ll_add_attention); |
| | | tv_video_resource = contentView.findViewById(R.id.tv_video_resource); |
| | | ll_add_attention = contentView.findViewById(R.id.ll_add_attention); |
| | | tv_title = contentView.findViewById(R.id.tv_title); |
| | | tv_score = contentView.findViewById(R.id.tv_score); |
| | | tv_play_num = contentView.findViewById(R.id.tv_play_num); |
| | | |
| | | |
| | | if (mVideoInfo.getAttention() == null) { |
| | | ll_add_attention.setVisibility(View.GONE); |
| | | } else { |
| | | ll_add_attention.setVisibility(View.VISIBLE); |
| | | iv_moive_img = (ImageView) contentView.findViewById(R.id.iv_moive_img); |
| | | tv_star_name = (TextView) contentView.findViewById(R.id.tv_star_name); |
| | | tv_update_time = (TextView) contentView.findViewById(R.id.tv_update_time); |
| | | tv_cancle_follow = (TextView) contentView.findViewById(R.id.tv_cancle_follow); |
| | | iv_moive_img = contentView.findViewById(R.id.iv_moive_img); |
| | | tv_star_name = contentView.findViewById(R.id.tv_star_name); |
| | | tv_update_time = contentView.findViewById(R.id.tv_update_time); |
| | | tv_cancle_follow = contentView.findViewById(R.id.tv_cancle_follow); |
| | | try { |
| | | Glide.with(getActivity().getApplicationContext()).load(mVideoInfo.getAttention().getMoviePicture()).error(R.drawable.ic_default).placeholder(R.drawable.ic_default).centerCrop().into(iv_moive_img); |
| | | } catch (IllegalArgumentException e) { |
| | |
| | | }); |
| | | } |
| | | |
| | | fl_native_ad1 = (FrameLayout) contentView |
| | | .findViewById(R.id.fl_native_ad_1); |
| | | gv_episode = (GridView) contentView.findViewById(R.id.gv_fragment_episode); |
| | | gv_episode.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, |
| | | LinearLayout.LayoutParams.WRAP_CONTENT)); |
| | | int padding = DimenUtils.dipToPixels(8, gv_episode.getContext()); |
| | | gv_episode.setPadding(padding, padding, padding, padding); |
| | | if (mVideoInfo.getShowType() == 1) {// 综艺或者电影 |
| | | gv_episode.setNumColumns(1); |
| | | } else if (mVideoInfo.getShowType() == 2) { |
| | | // 电视剧什么的 |
| | | gv_episode.setNumColumns(5); |
| | | } |
| | | gv_episode.setHorizontalSpacing(padding); |
| | | gv_episode.setVerticalSpacing(padding); |
| | | gv_episode.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); |
| | | gv_episode.setOnItemClickListener(new OnItemClickListener() { |
| | | @Override |
| | | public void onItemClick(AdapterView<?> parent, View view, |
| | | int position, long id) { |
| | | VideoDetailInfo videoDetailInfo = (VideoDetailInfo) parent |
| | | .getItemAtPosition(position); |
| | | if (selectedUrl == null) { |
| | | return; |
| | | } |
| | | mPlayingPosition = position; |
| | | episodeAdapter = new EpisodeAdapter(mVideoInfo, |
| | | mPlayingPosition); |
| | | episodeAdapter2 = new EpisodeAdapter2(mVideoInfo, |
| | | mPlayingPosition); |
| | | refresh(); |
| | | Playlocation playlocation = new Playlocation(); |
| | | playlocation.setPosition(position); |
| | | EventBus.getDefault().post(playlocation); |
| | | getUrl(videoDetailInfo); |
| | | } |
| | | }); |
| | | fl_add_to_favourite = (LinearLayout) contentView |
| | | .findViewById(R.id.fl_add_to_favourite); |
| | | tv_add_to_favourite = (TextView) contentView |
| | | .findViewById(R.id.tv_add_to_favourite); |
| | | fl_add_to_favourite.setOnClickListener(this); |
| | | contentView.findViewById(R.id.fl_share).setOnClickListener(this); |
| | | fl_report = (LinearLayout) contentView.findViewById(R.id.fl_report); |
| | | iv_report = (ImageView) contentView.findViewById(R.id.iv_report_more); |
| | | iv_favourite = (ImageView) contentView.findViewById(R.id.iv_add_to_favourite); |
| | | fl_report.setOnClickListener(this); |
| | | tv_offline_cache = (TextView) contentView.findViewById(R.id.tv_offline_cache); |
| | | fl_offline_cache = (LinearLayout) contentView |
| | | .findViewById(R.id.fl_offline_cache); |
| | | fl_offline_cache.setOnClickListener(this); |
| | | setVideoInfo(); |
| | | |
| | | episodeAdapter = new EpisodeAdapter(mVideoInfo, mPlayingPosition); |
| | | episodeAdapter2 = new EpisodeAdapter2(mVideoInfo, mPlayingPosition); |
| | | fl_native_ad1 = contentView |
| | | .findViewById(R.id.fl_native_ad_1); |
| | | rv_episode = contentView.findViewById(R.id.rv_episode); |
| | | if (mVideoInfo.getShowType() == 1) { |
| | | // 综艺或者电影 |
| | | episodeAdapter = new EpisodeNewAdapter(getContext(), mVideoInfo, EpisodeNewAdapter.TYPE_ZONGYI, mPlayingPosition); |
| | | } else if (mVideoInfo.getShowType() == 2) { |
| | | // 电视剧动漫 |
| | | episodeAdapter = new EpisodeNewAdapter(getContext(), mVideoInfo, EpisodeNewAdapter.TYPE_DIANSHIJU, mPlayingPosition); |
| | | } |
| | | LinearLayoutManager ms = new LinearLayoutManager(getContext()); |
| | | ms.setOrientation(LinearLayoutManager.HORIZONTAL); |
| | | |
| | | rv_episode.setLayoutManager(ms); |
| | | //设置间距 |
| | | DividerItemDecoration decoration = new DividerItemDecoration(); |
| | | decoration.setSize(com.weikou.beibeivideo.util.DimenUtils.dip2px(getContext(), 10)); |
| | | rv_episode.addItemDecoration(decoration); |
| | | rv_episode.setAdapter(episodeAdapter); |
| | | |
| | | |
| | | //TODO 点击事件响应 |
| | | // rv_episode.setOnItemClickListener(new OnItemClickListener() { |
| | | // @Override |
| | | // public void onItemClick(AdapterView<?> parent, View view, |
| | | // int position, long id) { |
| | | // VideoDetailInfo videoDetailInfo = (VideoDetailInfo) parent |
| | | // .getItemAtPosition(position); |
| | | // if (selectedUrl == null) { |
| | | // return; |
| | | // } |
| | | // mPlayingPosition = position; |
| | | // episodeAdapter = new EpisodeAdapter(mVideoInfo, |
| | | // mPlayingPosition); |
| | | // episodeAdapter2 = new EpisodeAdapter2(mVideoInfo, |
| | | // mPlayingPosition); |
| | | // refresh(); |
| | | // Playlocation playlocation = new Playlocation(); |
| | | // playlocation.setPosition(position); |
| | | // EventBus.getDefault().post(playlocation); |
| | | // getUrl(videoDetailInfo); |
| | | // } |
| | | // }); |
| | | contentView.findViewById(R.id.iv_share).setOnClickListener(this); |
| | | contentView.findViewById(R.id.iv_offline_cache).setOnClickListener(this); |
| | | fl_report = contentView.findViewById(R.id.fl_report); |
| | | iv_favourite = contentView.findViewById(R.id.iv_add_to_favourite); |
| | | fl_report.setOnClickListener(this); |
| | | iv_favourite.setOnClickListener(this); |
| | | |
| | | refresh(); |
| | | isCollect(); |
| | | loadAD1(); |
| | |
| | | |
| | | public void onEventMainThread(Playlocation playlocation) { |
| | | mPlayingPosition = playlocation.getPosition(); |
| | | episodeAdapter = new EpisodeAdapter(mVideoInfo, |
| | | mPlayingPosition); |
| | | episodeAdapter2 = new EpisodeAdapter2(mVideoInfo, |
| | | mPlayingPosition); |
| | | //TODO 重新赋值 |
| | | // episodeAdapter = new EpisodeAdapter(mVideoInfo, |
| | | // mPlayingPosition); |
| | | refresh(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | private void getUrl(VideoDetailInfo info) { |
| | | SharedPreferences preferences = iv_report.getContext().getSharedPreferences( |
| | | SharedPreferences preferences = getContext().getSharedPreferences( |
| | | "user", Context.MODE_PRIVATE); |
| | | String uid = preferences.getString("uid", ""); |
| | | BeibeiVideoAPI.getPlayUrl(iv_report.getContext(), uid, info.getType(), mVideoInfo.getId(), |
| | | BeibeiVideoAPI.getPlayUrl(getContext(), uid, info.getType(), mVideoInfo.getId(), |
| | | info.getId(), selectedUrl.getId(), info.geteId(), |
| | | new BasicTextHttpResponseHandler() { |
| | | |
| | |
| | | /** |
| | | * 刷新adapter |
| | | */ |
| | | public static void refresh() { |
| | | if (VideoEpisodeFragment.isShowMore && episodeAdapter != null) {// 展示更多 |
| | | gv_episode.setAdapter(episodeAdapter); |
| | | } else if ((!VideoEpisodeFragment.isShowMore) && episodeAdapter2 != null) { |
| | | gv_episode.setAdapter(episodeAdapter2); |
| | | } |
| | | |
| | | public void refresh() { |
| | | rv_episode.setAdapter(episodeAdapter); |
| | | } |
| | | |
| | | // 加载播放页第一条广告,先设置加载上下文环境和条件 |
| | | private void loadAD1() { |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(ll_add_attention.getContext(), new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | BeibeiConstant.GDT_ID, BeibeiConstant.GDT_PLAYER_NATIVE1, new NativeExpressAD.NativeExpressADListener() { |
| | | new ExpressAdManager(ExpressAdManager.SOURCE_GDT, getContext()).loadVideoDetailAd(1, new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | tv_add_to_favourite.post(new Runnable() { |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | |
| | | ExpressAdManager.render(getActivity(), adList.get(0), fl_native_ad1, new ExpressAdManager.IAdEventListener() { |
| | | @Override |
| | | public void run() { |
| | | if (null != list && list.size() > 0) { |
| | | NativeExpressADView adView = list.get(0); |
| | | adView.render(); |
| | | FrameLayout parent = (FrameLayout) adView.getParent(); |
| | | if (parent != null) { |
| | | parent.removeAllViews(); |
| | | } |
| | | fl_native_ad1.addView(adView); |
| | | } |
| | | public void closeAd() { |
| | | fl_native_ad1.removeAllViews(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure(NativeExpressADView nativeExpressADView) { |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADOpenOverlay(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADCloseOverlay(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | } |
| | | }); // 传入Activity |
| | | // 注意:如果您在联盟平台上新建原生模板广告位时,选择了支持视频,那么可以进行个性化设置(可选) |
| | | nativeExpressAD.setVideoOption(new VideoOption.Builder() |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频 |
| | | .setAutoPlayMuted(true) // 自动播放时为静音 |
| | | .build()); // |
| | | nativeExpressAD.loadAD(2); |
| | | }); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | SharedPreferences preferences = iv_report.getContext() |
| | | SharedPreferences preferences = getContext() |
| | | .getSharedPreferences("user", Context.MODE_PRIVATE); |
| | | switch (v.getId()) { |
| | | case R.id.fl_add_to_favourite: |
| | | case R.id.iv_add_to_favourite: |
| | | final String loginUid = preferences.getString("LoginUid", ""); |
| | | if (StringUtils.isEmpty(loginUid)) { |
| | | SingleToast.showToast(ll_add_attention.getContext(), "登录后才能收藏"); |
| | |
| | | break; |
| | | } |
| | | String uid = preferences.getString("uid", ""); |
| | | BeibeiVideoAPI.isCollect(iv_report.getContext(), uid, mVideoInfo.getId(), |
| | | BeibeiVideoAPI.isCollect(getContext(), uid, mVideoInfo.getId(), |
| | | mVideoInfo.getThirdType(), |
| | | new BasicTextHttpResponseHandler() { |
| | | |
| | |
| | | } |
| | | } |
| | | break; |
| | | case R.id.fl_offline_cache: |
| | | case R.id.iv_offline_cache: |
| | | Toast.makeText(ll_add_attention.getContext(), "暂时无法缓存!", Toast.LENGTH_SHORT).show(); |
| | | break; |
| | | case R.id.fl_share: |
| | | case R.id.iv_share: |
| | | String shareContent = getShareContent(); |
| | | UMWeb web = new UMWeb(getShareUrl()); |
| | | String shareTitle = getResources().getString(R.string.app_name); |
| | |
| | | public void onEventMainThread(VideoInfo videoInfo) { |
| | | mVideoInfo = videoInfo; |
| | | setFrom(videoInfo); |
| | | if (mVideoInfo.isCanSave()) { |
| | | // fl_offline_cache.setEnabled(true); |
| | | // tv_offline_cache.setText("缓存"); |
| | | } else { |
| | | // fl_offline_cache.setEnabled(false); |
| | | // tv_offline_cache.setText("无法缓存"); |
| | | } |
| | | fl_add_to_favourite.setEnabled(true); |
| | | iv_favourite.setEnabled(true); |
| | | fl_report.setEnabled(true); |
| | | if (VideoEpisodeFragment.isShowMore) {// 展示更多 |
| | | gv_episode.setAdapter(episodeAdapter); |
| | | } else { |
| | | gv_episode.setAdapter(episodeAdapter2); |
| | | } |
| | | // isCollect(); |
| | | rv_episode.setAdapter(episodeAdapter); |
| | | } |
| | | |
| | | private void setFrom(VideoInfo info) { |
| | |
| | | } |
| | | } |
| | | EventBus.getDefault().post(selectedUrl); |
| | | tv_add_to_favourite.postDelayed(new Runnable() { |
| | | iv_favourite.postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | |
| | | |
| | | if (mVideoInfo.getResourceList() != null |
| | | && mVideoInfo.getResourceList().size() > 0) { |
| | | // tv_report.setText("来源:"); |
| | | iv_report.setVisibility(View.VISIBLE); |
| | | tv_video_resource.setVisibility(View.VISIBLE); |
| | | if (selectedUrl == null || selectedUrl.getPicture() == null) { |
| | | Glide.with(getActivity().getApplicationContext()).load(R.drawable.from_other).into(iv_report); |
| | | tv_video_resource.setText("来源:其他"); |
| | | } else { |
| | | // Glide.with(getActivity().getApplicationContext()).load(selectedUrl.getPicture()).placeholder(R.drawable.from_other).error(R.drawable.from_other).into(iv_report); |
| | | ImageLoader.getInstance().displayImage( |
| | | selectedUrl.getPicture(), iv_report, option); |
| | | tv_video_resource.setText("来源:" + selectedUrl.getName()); |
| | | } |
| | | popupWindow = new PopupWindow( |
| | | com.weikou.beibeivideo.util.DimenUtils.dip2px(iv_report.getContext(), 120), |
| | | com.weikou.beibeivideo.util.DimenUtils.dip2px(getContext(), 120), |
| | | android.view.WindowManager.LayoutParams.WRAP_CONTENT); |
| | | popupWindow.setOutsideTouchable(true);// 点击外部可点击 |
| | | popupWindow.setBackgroundDrawable(new ColorDrawable(0));// 设置背景 |
| | | popupWindow.setAnimationStyle(R.style.PopupAnimation); |
| | | popupWindow.setFocusable(true);// 获取焦点 |
| | | |
| | | ListView lv = new ListView(iv_report.getContext()); |
| | | ListView lv = new ListView(getContext()); |
| | | ListView.LayoutParams param = new ListView.LayoutParams( |
| | | FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); |
| | | lv.setLayoutParams(param); |
| | |
| | | .getThirdType(), true); |
| | | } |
| | | selectedUrl = urlList.get(position); |
| | | iv_report.setVisibility(View.VISIBLE); |
| | | if (selectedUrl == null || selectedUrl.getPicture() == null) { |
| | | // ImageLoader.getInstance().displayImage( |
| | | // "drawable://" + R.drawable.from_other, |
| | | // iv_report); |
| | | Glide.with(getActivity().getApplicationContext()).load(R.drawable.from_other).into(iv_report); |
| | | tv_video_resource.setText("来源:其他"); |
| | | } else { |
| | | Glide.with(getActivity().getApplicationContext()).load(selectedUrl.getPicture()).placeholder(R.drawable.from_other).error(R.drawable.from_other).into(iv_report); |
| | | // ImageLoader.getInstance().displayImage( |
| | | // selectedUrl.getPicture(), iv_report, option); |
| | | tv_video_resource.setText("来源:" + selectedUrl.getName()); |
| | | } |
| | | |
| | | } |
| | |
| | | * Window dialogWindow = dialog.getWindow(); dialogWindow.get |
| | | */ |
| | | } else { |
| | | iv_report.setVisibility(View.GONE); |
| | | // tv_report.setText("其它"); |
| | | tv_video_resource.setVisibility(View.GONE); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private void getVideoDetail(String videoId, final String resourceId, |
| | | String videoThirdType, final boolean isSetup) { |
| | | SharedPreferences preferences = iv_report.getContext().getSharedPreferences( |
| | | SharedPreferences preferences = getContext().getSharedPreferences( |
| | | "user", Context.MODE_PRIVATE); |
| | | String uid = preferences.getString("uid", ""); |
| | | String loginid = preferences.getString("LoginUid", ""); |
| | | BeibeiVideoAPI.getVideoDetail(iv_report.getContext(), uid, resourceId, videoId, loginid, |
| | | BeibeiVideoAPI.getVideoDetail(getContext(), uid, resourceId, videoId, loginid, |
| | | videoThirdType, new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | |
| | | |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | Toast.makeText(iv_report.getContext(), "影片已删除", |
| | | Toast.makeText(getContext(), "影片已删除", |
| | | Toast.LENGTH_LONG).show(); |
| | | getActivity().finish(); |
| | | return; |
| | |
| | | int position = 0; |
| | | // boolean isFromWatchHistory = false; |
| | | // isFromWatchHistory = getArguments().getBoolean("isFromWatchHistory", false);// 是否从观看记录点击过来 |
| | | Cursor cursor = gv_episode.getContext().getContentResolver().query( |
| | | Cursor cursor = rv_episode.getContext().getContentResolver().query( |
| | | WatchHistoryTable.CONTENT_URI, null, |
| | | WatchHistoryTable.VIDEO_ID + " = ? ", |
| | | new String[]{videoInfo.getId()}, null); |
| | |
| | | // position)); |
| | | // } |
| | | } else { |
| | | tv_offline_cache.postDelayed(new Runnable() { |
| | | iv_favourite.postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | |
| | | * @param thirdType |
| | | */ |
| | | private void getScoreCollect(String loginUid, final String type, String thirdType) { |
| | | SharedPreferences preferences = iv_report.getContext().getSharedPreferences( |
| | | SharedPreferences preferences = getContext().getSharedPreferences( |
| | | "user", Context.MODE_PRIVATE); |
| | | String uid = preferences.getString("uid", ""); |
| | | BeibeiVideoAPI.getScoreCollect(iv_report.getContext(), uid, loginUid, mVideoInfo.getId(), |
| | | BeibeiVideoAPI.getScoreCollect(getContext(), uid, loginUid, mVideoInfo.getId(), |
| | | thirdType, type, new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | if (type.equals("1")) { |
| | | SingleToast.showToast(iv_report.getContext(), "收藏成功"); |
| | | SingleToast.showToast(getContext(), "收藏成功"); |
| | | } else { |
| | | SingleToast.showToast(iv_report.getContext(), "取消收藏成功"); |
| | | SingleToast.showToast(getContext(), "取消收藏成功"); |
| | | } |
| | | } else { |
| | | if (type.equals("1")) { |
| | | SingleToast.showToast(iv_report.getContext(), "收藏失败"); |
| | | SingleToast.showToast(getContext(), "收藏失败"); |
| | | } else { |
| | | SingleToast.showToast(iv_report.getContext(), "取消收藏失败"); |
| | | SingleToast.showToast(getContext(), "取消收藏失败"); |
| | | } |
| | | } |
| | | isCollect(); |
| | |
| | | } |
| | | |
| | | private void isCollect() { |
| | | SharedPreferences preferences = tv_add_to_favourite.getContext().getSharedPreferences( |
| | | SharedPreferences preferences = iv_favourite.getContext().getSharedPreferences( |
| | | "user", Context.MODE_PRIVATE); |
| | | String uid = preferences.getString("uid", ""); |
| | | BeibeiVideoAPI.isCollect(tv_add_to_favourite.getContext(), uid, mVideoInfo.getId(), |
| | | BeibeiVideoAPI.isCollect(iv_favourite.getContext(), uid, mVideoInfo.getId(), |
| | | mVideoInfo.getThirdType(), new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |