|
|
@@ -14,6 +14,7 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
+import com.sheep.gamegroup.absBase.AbsObserver;
|
|
|
import com.sheep.gamegroup.absBase.BaseUMActivity;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.DiscoveryVideo;
|
|
|
@@ -41,6 +42,7 @@ import java.util.ArrayList;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
+import io.reactivex.disposables.Disposable;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
@@ -59,6 +61,8 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
//播放
|
|
|
@BindView(R.id.detail_player)
|
|
|
StandardGSYVideoPlayer videoPlayer;
|
|
|
+ @BindView(R.id.gsy_video_play_iv)
|
|
|
+ View gsy_video_play_iv;//播放按钮
|
|
|
@BindView(R.id.video_loading)
|
|
|
View video_loading;
|
|
|
|
|
|
@@ -137,7 +141,6 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
}
|
|
|
|
|
|
private boolean isPlay = false;
|
|
|
- private boolean isPause = false;
|
|
|
private ImageView coverImageView;
|
|
|
private boolean isInit = false;
|
|
|
private void initPlay() {
|
|
|
@@ -179,6 +182,39 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
ViewUtil.setImage(coverImageView, getVideoCoverUrl());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private Disposable disposable;
|
|
|
+ private void playOrPause() {
|
|
|
+// gsy_video_play_iv
|
|
|
+ if(isPlaying()){
|
|
|
+ isPlay = false;
|
|
|
+ ViewUtil.setVisibility(gsy_video_play_iv, true);
|
|
|
+ if(disposable != null && !disposable.isDisposed()){
|
|
|
+ disposable.dispose();
|
|
|
+ }
|
|
|
+ ViewUtil.delay(new AbsObserver<Integer>(){
|
|
|
+ @Override
|
|
|
+ public void onSubscribe(Disposable d) {
|
|
|
+ disposable = d;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onNext(Integer integer) {
|
|
|
+ ViewUtil.setVisibility(gsy_video_play_iv, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onComplete() {
|
|
|
+ disposable = null;
|
|
|
+ }
|
|
|
+ }, 2);
|
|
|
+ videoPlayer.onVideoPause();
|
|
|
+ } else {
|
|
|
+ isPlay = true;
|
|
|
+ ViewUtil.setVisibility(gsy_video_play_iv, false);
|
|
|
+ videoPlayer.onVideoResume();
|
|
|
+ }
|
|
|
+ }
|
|
|
//点赞
|
|
|
public void onClickVideoLike(View view) {
|
|
|
ViewUtil.setEnabled(video_like_tv, false);
|
|
|
@@ -351,7 +387,7 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
|
|
|
//是否正在播放视频
|
|
|
private boolean isPlaying(){
|
|
|
- return isPlay && !isPause;
|
|
|
+ return isPlay;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -378,14 +414,18 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
videoPlayer.onVideoResume();
|
|
|
super.onResume();
|
|
|
updateVideoCommentNo();
|
|
|
- isPause = false;
|
|
|
+ isPlay = true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void onPause() {
|
|
|
videoPlayer.onVideoPause();
|
|
|
+ //取消 播放按钮图片消失的事件
|
|
|
+ if(disposable != null && !disposable.isDisposed()){
|
|
|
+ disposable.dispose();
|
|
|
+ }
|
|
|
super.onPause();
|
|
|
- isPause = true;
|
|
|
+ isPlay = false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -426,9 +466,7 @@ public class ActVideoDetail extends BaseUMActivity {
|
|
|
LogUtil.println("mGestureListener", "onSingleTapConfirmed");
|
|
|
ViewUtil.toggleVisibility(video_top);
|
|
|
ViewUtil.setVisibility(video_bottom, ViewUtil.isVisible(video_top));
|
|
|
-// if(isPlaying)
|
|
|
-// isPauseByUser = true;
|
|
|
-// playOrPause();
|
|
|
+ playOrPause();
|
|
|
return super.onSingleTapConfirmed(e);
|
|
|
}
|
|
|
@Override
|