| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialAD; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.yeshi.base.entity.AccumulateRule; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.entity.db.WatchHistoryTable; |
| | | import com.yeshi.base.entity.video.Follow; |
| | | import com.yeshi.base.entity.video.Play; |
| | |
| | | import com.yeshi.base.entity.video.VideoResource; |
| | | import com.yeshi.base.ui.BaseActivity; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.ad.TTAdManagerHolder; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.video.R; |
| | | import com.yeshi.video.entity.PushEpisode; |
| | |
| | | |
| | | private FrameLayout fl_pptv; |
| | | private LinearLayout ll_other; |
| | | |
| | | private boolean adShown = false; |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | |
| | | if (!mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_play_container, mFunshionPlayerFragment).commit(); |
| | | } |
| | | fl_video_play_background.setVisibility(View.GONE); |
| | | hideImage(); |
| | | |
| | | |
| | | } else {// |
| | |
| | | if (!progressDialog.isShowing()) { |
| | | progressDialog.show(); |
| | | } |
| | | getVideoDetail(this, videoInfo.getId(), videoInfo.getThirdType(), false); |
| | | getVideoDetail(this, videoInfo.getId(), videoInfo.getThirdType(), true); |
| | | } |
| | | |
| | | public void onEventMainThread(Play info) { |
| | |
| | | } |
| | | |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | final VideoInfo videoInfo = gson |
| | | final VideoInfo videoInfo = JsonUtil.videoGson |
| | | .fromJson(jsonObject.getJSONObject("Data") |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoResource resource = gson.fromJson( |
| | | VideoResource resource = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONObject("Resource") |
| | | .toString(), |
| | |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL_ID, videoDetailId); |
| | | values.put(WatchHistoryTable.VIDEO_THIRD_TYPE, |
| | | videoInfo.getThirdType()); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL, gson.toJson(videoInfo)); |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL, JsonUtil.videoGson.toJson(videoInfo)); |
| | | values.put(WatchHistoryTable.WATCH_TIME, 0); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE, from); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE_ID, resoureID); |
| | |
| | | /** |
| | | * 加载全屏视频广告 |
| | | */ |
| | | private UnifiedInterstitialAD iad; |
| | | |
| | | private void loadFullVideoAd() { |
| | | if (BeibeiConstant.ADSHOW) { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess(TTFullScreenVideoAd ad) { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | } |
| | | }); |
| | | if (adShown) |
| | | return; |
| | | adShown = true; |
| | | |
| | | if (AdUtil.getAdType(getApplicationContext(), AdPositionEnum.videoDetailFullVideo) != null) { |
| | | |
| | | if (TTAdSdk.isInitSuccess()) { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess(TTFullScreenVideoAd ad) { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | } |
| | | }); |
| | | } else { |
| | | iad = new UnifiedInterstitialAD(this, getString(R.string.ad_gdt_pid_video_detail_insert), new UnifiedInterstitialADListener() { |
| | | |
| | | @Override |
| | | public void onADReceive() { |
| | | iad.showAsPopupWindow(VideoDetailActivity.this); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | |
| | | Log.i("gdt", adError.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onADOpened() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | |
| | | } |
| | | }); |
| | | VideoOption.Builder builder = new VideoOption.Builder(); |
| | | VideoOption |
| | | option = builder.setAutoPlayMuted(true) |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI).build(); |
| | | iad.setVideoOption(option); |
| | | iad.loadAD(); |
| | | } |
| | | } |
| | | } |
| | | } |