提交 e7fc854d 编写于 作者: S shuyu

orientation 增加 pause 支持

上级 39110e9b
...@@ -84,6 +84,9 @@ public abstract class GSYBaseActivityDetail<T extends GSYBaseVideoPlayer> extend ...@@ -84,6 +84,9 @@ public abstract class GSYBaseActivityDetail<T extends GSYBaseVideoPlayer> extend
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
getGSYVideoPlayer().getCurrentPlayer().onVideoPause(); getGSYVideoPlayer().getCurrentPlayer().onVideoPause();
if (orientationUtils != null) {
orientationUtils.setIsPause(true);
}
isPause = true; isPause = true;
} }
...@@ -91,6 +94,9 @@ public abstract class GSYBaseActivityDetail<T extends GSYBaseVideoPlayer> extend ...@@ -91,6 +94,9 @@ public abstract class GSYBaseActivityDetail<T extends GSYBaseVideoPlayer> extend
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
getGSYVideoPlayer().getCurrentPlayer().onVideoResume(); getGSYVideoPlayer().getCurrentPlayer().onVideoResume();
if (orientationUtils != null) {
orientationUtils.setIsPause(false);
}
isPause = false; isPause = false;
} }
......
...@@ -28,6 +28,8 @@ public class OrientationUtils { ...@@ -28,6 +28,8 @@ public class OrientationUtils {
//是否跟随系统 //是否跟随系统
private boolean mRotateWithSystem = true; private boolean mRotateWithSystem = true;
private boolean mIsPause = false;
/** /**
* @param activity * @param activity
* @param gsyVideoPlayer * @param gsyVideoPlayer
...@@ -49,6 +51,9 @@ public class OrientationUtils { ...@@ -49,6 +51,9 @@ public class OrientationUtils {
if (gsyVideoPlayer != null && gsyVideoPlayer.isVerticalFullByVideoSize()) { if (gsyVideoPlayer != null && gsyVideoPlayer.isVerticalFullByVideoSize()) {
return; return;
} }
if (mIsPause) {
return;
}
// 设置竖屏 // 设置竖屏
if (((rotation >= 0) && (rotation <= 30)) || (rotation >= 330)) { if (((rotation >= 0) && (rotation <= 30)) || (rotation >= 330)) {
if (mClick) { if (mClick) {
...@@ -244,4 +249,12 @@ public class OrientationUtils { ...@@ -244,4 +249,12 @@ public class OrientationUtils {
public void setRotateWithSystem(boolean rotateWithSystem) { public void setRotateWithSystem(boolean rotateWithSystem) {
this.mRotateWithSystem = rotateWithSystem; this.mRotateWithSystem = rotateWithSystem;
} }
public boolean isPause() {
return mIsPause;
}
public void setIsPause(boolean isPause) {
this.mIsPause = isPause;
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册