| | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.video.VideoDataNotifyDialog; |
| | | import com.lcjian.library.video.VideoLoadingDialog; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | |
| | | import com.weikou.beibeivideo.ui.common.ShareActivity; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | import com.weikou.beibeivideo.ui.mine.FXBrowserActivity; |
| | | import com.weikou.beibeivideo.ui.video.FunshionPlayerFragment; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.ad.FullVideoAdManager; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.ui.IPageEventListener; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | |
| | | |
| | | private VideoDetailVideoAdFragment mVideoDetailVideoAdFragment; |
| | | |
| | | //风行播放器 |
| | | private FunshionPlayerFragment mFunshionPlayerFragment; |
| | | |
| | | private ImageView iv_select_play; |
| | | |
| | | private FrameLayout fl_ad; |
| | |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.video_detail_activity); |
| | | |
| | | new VideoDataNotifyDialog.Builder().build(this).show(); |
| | | |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | |
| | | /** |
| | | * 广告 |
| | | */ |
| | | //广告 |
| | | mVideoDetailVideoAdFragment = new VideoDetailVideoAdFragment(); |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_ad, mVideoDetailVideoAdFragment).commit(); |
| | | //播放器 |
| | | mFunshionPlayerFragment = new FunshionPlayerFragment(); |
| | | |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_ad, mVideoDetailVideoAdFragment).commit(); |
| | | |
| | | initView(); |
| | | |
| | |
| | | if (getIntent().getSerializableExtra("video_info") != null) { |
| | | videoInfo = (VideoInfo) getIntent().getSerializableExtra( |
| | | "video_info"); |
| | | if(videoInfo!=null) |
| | | if (videoInfo != null) |
| | | videoInfo.setVideoDetailList(null); |
| | | if (getIntent().getBooleanExtra("isFromWatchHistory", false)) { |
| | | Cursor cursor = getContentResolver().query( |
| | |
| | | .findFragmentByTag("VideoDetailFragment"); |
| | | if (videoDetailFragment == null) { |
| | | videoDetailFragment = new VideoDetailFragment(); |
| | | Bundle bundle=new Bundle(); |
| | | bundle.putInt("playing_position",getIntent().getIntExtra("playing_position",0)); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putInt("playing_position", getIntent().getIntExtra("playing_position", 0)); |
| | | videoDetailFragment.setArguments(bundle); |
| | | |
| | | fm.beginTransaction() |
| | |
| | | |
| | | private boolean isFirst = true; |
| | | |
| | | private void startPlay() { |
| | | private synchronized void startPlay() { |
| | | //移除所有的fragment |
| | | if (mVideoDetailVideoAdFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commit(); |
| | | } |
| | | |
| | | if (mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().remove(mFunshionPlayerFragment).commit(); |
| | | } |
| | | |
| | | iv_select_play.setVisibility(View.GONE); |
| | | |
| | | if (fl_ad.getVisibility() == View.VISIBLE && BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isPlayerAd()) { |
| | | mVideoDetailVideoAdFragment.loadVideoAD(new VideoDetailVideoAdFragment.IVideoAdListener() { |
| | | //需要加载广告 |
| | | if (BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isPlayerAd()) { |
| | | mVideoDetailVideoAdFragment = new VideoDetailVideoAdFragment(); |
| | | mVideoDetailVideoAdFragment.setPageEventListener(new IPageEventListener() { |
| | | @Override |
| | | public void finishPlay() { |
| | | clickPlay(); |
| | | fl_ad.setVisibility(View.GONE); |
| | | } |
| | | public void onCreateView() { |
| | | mVideoDetailVideoAdFragment.loadVideoAD(new VideoDetailVideoAdFragment.IVideoAdListener() { |
| | | @Override |
| | | public void finishPlay() { |
| | | getSupportFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment); |
| | | clickPlay();//进入播放事件 |
| | | } |
| | | |
| | | @Override |
| | | public void startPlay() { |
| | | @Override |
| | | public void startPlay() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | |
| | | if (!mVideoDetailVideoAdFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_ad, mVideoDetailVideoAdFragment).commit(); |
| | | } |
| | | |
| | | } else {//进入播放视频事件 |
| | | clickPlay(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | Toast.LENGTH_LONG).show(); |
| | | return; |
| | | } else if (playUrl.getPlayType() == 1) { |
| | | Intent intent = new Intent(VideoDetailActivity.this, |
| | | FXBrowserActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | // Intent intent = new Intent(VideoDetailActivity.this, |
| | | // FXBrowserActivity.class); |
| | | // intent.putExtra("url", playUrl.getUrl()); |
| | | // startActivity(intent); |
| | | saveWatchHistory("风行"); |
| | | } |
| | | fl_video_play_background.setVisibility(View.GONE); |
| | | //播放风行视频 |
| | | //添加风行播放页 |
| | | mFunshionPlayerFragment = new FunshionPlayerFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("vid", "83693903"); |
| | | mFunshionPlayerFragment.setArguments(bundle); |
| | | if (!mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_play_container, mFunshionPlayerFragment).commit(); |
| | | } |
| | | //开始播放视频 |
| | | } else { |
| | | if (playUrl.getPlayType() == 0) { |
| | | Toast.makeText(VideoDetailActivity.this, "此节目不可播!", |
| | |
| | | private void checkConfiguration(Configuration newConfig) { |
| | | if (newConfig == null) |
| | | return; |
| | | if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { |
| | | if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {//横屏 |
| | | // Hide the status bar隐藏状态栏 |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | | attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | |
| | | R.id.fragment_video_play_container).getLayoutParams(); |
| | | layoutParams.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
| | | findViewById(R.id.fragment_video_play_container).requestLayout(); |
| | | |
| | | |
| | | } else { |
| | | // Show the status bar显示状态栏 |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | |
| | | .getBooleanExtra("isFromWatchHistory", |
| | | false);// 是否从观看记录点击过来 |
| | | Log.i("mResult", "是否是从观看记录点击进来的:" + isFromWatchHistory); |
| | | if (isFromWatchHistory||position>0) { |
| | | if (isFromWatchHistory || position > 0) { |
| | | mPosition = getIntent().getIntExtra("playing_position", 0); |
| | | EventBus.getDefault().post(videoInfo); |
| | | getUrl(videoInfo.getVideoDetailList().get(mPosition), isSetup); |