Skip to content

Commit

Permalink
orientation 增加 pause 支持
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Feb 18, 2019
1 parent 39110e9 commit e7fc854
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,19 @@ public void onBackPressed() {
protected void onPause() {
super.onPause();
getGSYVideoPlayer().getCurrentPlayer().onVideoPause();
if (orientationUtils != null) {
orientationUtils.setIsPause(true);
}
isPause = true;
}

@Override
protected void onResume() {
super.onResume();
getGSYVideoPlayer().getCurrentPlayer().onVideoResume();
if (orientationUtils != null) {
orientationUtils.setIsPause(false);
}
isPause = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class OrientationUtils {
//是否跟随系统
private boolean mRotateWithSystem = true;

private boolean mIsPause = false;

/**
* @param activity
* @param gsyVideoPlayer
Expand All @@ -49,6 +51,9 @@ public void onOrientationChanged(int rotation) {
if (gsyVideoPlayer != null && gsyVideoPlayer.isVerticalFullByVideoSize()) {
return;
}
if (mIsPause) {
return;
}
// 设置竖屏
if (((rotation >= 0) && (rotation <= 30)) || (rotation >= 330)) {
if (mClick) {
Expand Down Expand Up @@ -244,4 +249,12 @@ public boolean isRotateWithSystem() {
public void setRotateWithSystem(boolean rotateWithSystem) {
this.mRotateWithSystem = rotateWithSystem;
}

public boolean isPause() {
return mIsPause;
}

public void setIsPause(boolean isPause) {
this.mIsPause = isPause;
}
}

0 comments on commit e7fc854

Please sign in to comment.