package com.yeshi.video.ui;
|
|
import android.content.Intent;
|
import android.os.Bundle;
|
import android.view.LayoutInflater;
|
import android.view.View;
|
import android.view.View.OnClickListener;
|
import android.view.ViewGroup;
|
import android.widget.TextView;
|
|
import com.yeshi.base.entity.ad.AdPositionEnum;
|
import com.yeshi.base.entity.video.VideoInfo;
|
import com.yeshi.base.utils.BeibeiConstant;
|
import com.yeshi.base.utils.ad.AdUtil;
|
import com.yeshi.video.R;
|
|
import androidx.fragment.app.Fragment;
|
import de.greenrobot.event.EventBus;
|
|
public class VideoPlayerFragment extends Fragment {
|
|
private VideoInfo mVideoInfo;
|
private TextView tv_title;
|
|
public static class FavouriteEvent {
|
|
}
|
|
public static class PlayEvent {
|
|
}
|
|
@Override
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
Bundle savedInstanceState) {
|
View view = inflater
|
.inflate(R.layout.videodetail_top, container, false);
|
tv_title = (TextView) view.findViewById(R.id.tv_top_bar_left);
|
tv_title.setOnClickListener(new OnClickListener() {
|
|
@Override
|
public void onClick(View arg0) {
|
// TODO Auto-generated method stub
|
getActivity().finish();
|
}
|
});
|
view.findViewById(R.id.iv_start_play).setOnClickListener(
|
new OnClickListener() {
|
|
@Override
|
public void onClick(View arg0) {
|
if (mVideoInfo != null) {
|
Intent intent = new Intent(getActivity(),
|
VideoPlayerBrowserActivity.class);
|
intent.putExtra("url",
|
mVideoInfo.getVideoDetailList().get(0)
|
.getUrls().get(0).getUrl());
|
startActivity(intent);
|
}
|
}
|
});
|
if (AdUtil.getAdType(getContext(), AdPositionEnum.other) != null) {
|
showInterstitialAd();
|
}
|
|
return view;
|
}
|
|
public void onEventMainThread(VideoInfo videoInfo) {
|
mVideoInfo = videoInfo;
|
if (mVideoInfo != null) {
|
tv_title.setText(mVideoInfo.getName());
|
}
|
}
|
|
@Override
|
public void onResume() {
|
super.onResume();
|
EventBus.getDefault().register(this);
|
}
|
|
@Override
|
public void onPause() {
|
super.onPause();
|
EventBus.getDefault().unregister(this);
|
}
|
|
/**
|
* 广点通插屏广告
|
*/
|
private void showInterstitialAd() {
|
|
}
|
}
|