提交 0ae79fdd 编写于 作者: S shuyu

修改了demo (2017-08-28)

上级 b496a434
......@@ -168,19 +168,7 @@ public class DanmkuVideoActivity extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!danmakuVideoPlayer.isIfCurrentIsFullscreen()) {
danmakuVideoPlayer.startWindowFullscreen(DanmkuVideoActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (danmakuVideoPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
danmakuVideoPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -184,19 +184,7 @@ public class DetailControlActivity extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!detailPlayer.isIfCurrentIsFullscreen()) {
detailPlayer.startWindowFullscreen(DetailControlActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (detailPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -174,19 +174,7 @@ public class DetailListPlayer extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!detailPlayer.isIfCurrentIsFullscreen()) {
detailPlayer.startWindowFullscreen(DetailListPlayer.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (detailPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -179,19 +179,7 @@ public class DetailMoreTypeActivity extends AppCompatActivity{
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!detailPlayer.isIfCurrentIsFullscreen()) {
detailPlayer.startWindowFullscreen(DetailMoreTypeActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (detailPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -198,19 +198,7 @@ public class DetailPlayer extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!detailPlayer.isIfCurrentIsFullscreen()) {
detailPlayer.startWindowFullscreen(DetailPlayer.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (detailPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -176,19 +176,7 @@ public class InputUrlDetailActivity extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!detailPlayer.isIfCurrentIsFullscreen()) {
detailPlayer.startWindowFullscreen(InputUrlDetailActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (detailPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -200,19 +200,7 @@ public class WebDetailActivity extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (isPlay && !isPause && !isSamll) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!webPlayer.isIfCurrentIsFullscreen()) {
webPlayer.startWindowFullscreen(WebDetailActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (webPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
webPlayer.onConfigurationChanged(this, newConfig, orientationUtils);
}
}
......
......@@ -2,6 +2,8 @@ package com.shuyu.gsyvideoplayer.video.base;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Point;
import android.util.AttributeSet;
......@@ -17,6 +19,7 @@ import com.shuyu.gsyvideoplayer.SmallVideoTouch;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.utils.Debuger;
import com.shuyu.gsyvideoplayer.utils.OrientationUtils;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
import com.transitionseverywhere.TransitionManager;
import java.lang.reflect.Constructor;
......@@ -396,6 +399,32 @@ public abstract class GSYBaseVideoPlayer extends GSYVideoControlView {
/************************* 开放接口 *************************/
/**
* 旋转处理
*
* @param activity 页面
* @param newConfig 配置
* @param orientationUtils 旋转工具类
*/
public void onConfigurationChanged(Activity activity, Configuration newConfig, OrientationUtils orientationUtils) {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!isIfCurrentIsFullscreen()) {
startWindowFullscreen(activity, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(activity);
}
if (orientationUtils != null) {
orientationUtils.setEnable(true);
}
}
}
/**
* 利用window层播放全屏效果
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册