| | |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.entity.VideoResource; |
| | | import com.weikou.beibeivideo.entity.video.ChangeVideoEvent; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.ad.PlayVideoPreADFragment; |
| | | import com.weikou.beibeivideo.ui.common.ShareActivity; |
| | | import com.weikou.beibeivideo.ui.mine.FXBrowserActivity; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerBrowserActivity; |
| | | import com.weikou.beibeivideo.ui.video.FunshionPlayerFragment; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | |
| | | public class VideoDetailActivity2 extends BaseActivity implements |
| | | OnClickListener { |
| | | |
| | | private final String TAG = "VideoDetailActivity2"; |
| | | private final String TAG = VideoDetailActivity2.class.getName(); |
| | | |
| | | // private boolean mLandscape; |
| | | private VideoInfo videoInfo; |
| | |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.video_detail_activity); |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | VideoUtil.clearVideoEpisodeList(this); |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | |
| | | if (BeibeiConstant.AD_TYPE.isVideoDetailSplashAd()) { |
| | | if (FullVideoAdManager.getInstance().isCacahed()) { |
| | | FullVideoAdManager.getInstance().showAd(this); |
| | | } else { |
| | | FullVideoAdManager.getInstance().loadAd(BeibeiVideoApplication.application, new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess(TTFullScreenVideoAd ad) { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity2.this); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (BeibeiConstant.IS_TEST) |
| | | BeibeiConstant.AD_TYPE = null; |
| | | //需要加载广告 |
| | | if (BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isPlayerAd()) { |
| | | if (BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isPlayerAd() && playUrl.getPlayType() != 2) { |
| | | mVideoDetailVideoAdFragment = new PlayVideoPreADFragment(); |
| | | mVideoDetailVideoAdFragment.setPageEventListener(new IPageEventListener() { |
| | | @Override |
| | |
| | | videoInfo.getResourceList().get(i).setChecked(false); |
| | | } |
| | | } |
| | | |
| | | //播放统计 |
| | | BeibeiVideoAPI.playStatistic(BeibeiVideoApplication.application, videoInfo.getId(), playUrl.getResource().getId() + "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | }); |
| | | |
| | | if (playUrl.getResource().getName().contains("爱奇艺")) { |
| | | if (playUrl != null) { |
| | | if (playUrl.getPlayType() == 0) { |
| | |
| | | return; |
| | | } else if (playUrl.getPlayType() == 1) { |
| | | Intent intent = new Intent(VideoDetailActivity2.this, |
| | | VideoPlayerActivity.class); |
| | | VideoPlayerBrowserActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | initPlayer(); |
| | |
| | | return; |
| | | } else if (playUrl.getPlayType() == 1) { |
| | | Intent intent = new Intent(VideoDetailActivity2.this, |
| | | FXBrowserActivity.class); |
| | | VideoPlayerBrowserActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | saveWatchHistory("风行"); |
| | |
| | | return; |
| | | } else if (playUrl.getPlayType() == 1) { |
| | | Intent intent = new Intent(VideoDetailActivity2.this, |
| | | VideoPlayerActivity.class); |
| | | VideoPlayerBrowserActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | saveWatchHistory(playUrl.getResource().getName()); |
| | |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | Log.i(TAG, "onResume"); |
| | | super.onResume(); |
| | | EventBus.getDefault().register(this); |
| | | if (fl_ad.getVisibility() == View.GONE) { |
| | |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | Log.i(TAG, "onPause"); |
| | | super.onPause(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | |
| | | } catch (IndexOutOfBoundsException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void onEventMainThread(VideoInfo info) { |
| | |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | if (videoInfo != null) { |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | VideoUtil.videoEpisodeList.addAll(videoInfo.getVideoDetailList()); |
| | | VideoUtil.saveVideoEpisodeList(BeibeiVideoApplication.application, videoInfo.getVideoDetailList(), false); |
| | | } |
| | | // 附加字段 |
| | | if (jsonObject.optJSONObject("Extra1") != null) { |
| | |
| | | } |
| | | } |
| | | getUrl(VideoUtil.videoEpisodeList.get(0), |
| | | isSetup); |
| | | true); |
| | | findViewById(android.R.id.content).postDelayed( |
| | | new Runnable() { |
| | | |
| | |
| | | .optString("Params")); |
| | | info.setAid(data.optString("Aid")); |
| | | info.setVid(data.optString("Vid")); |
| | | info.setCode(jsonObject.getJSONObject("Data") |
| | | .optString("Code")); |
| | | playUrl = info; |
| | | if (videoInfo == null) { |
| | | return; |
| | |
| | | transaction.commitAllowingStateLoss(); |
| | | checkConfiguration(getResources().getConfiguration()); |
| | | Log.i(TAG, "update"); |
| | | } |
| | | |
| | | public static class ChangeVideoEvent { |
| | | private VideoInfo videoInfo; |
| | | |
| | | private String tag; |
| | | |
| | | public VideoInfo getVideoInfo() { |
| | | return videoInfo; |
| | | } |
| | | |
| | | public void setVideoInfo(VideoInfo videoInfo) { |
| | | this.videoInfo = videoInfo; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |