提交 f0cf7bb9 编写于 作者: S shuyu

增加旋转使能后是否跟随系统设置 (2017-06-24)

上级 54d28fd8
## 下方个版本说明,可以当做简单的wiki使用~,效果可参考DEMO。
### 1.6.8(2017-06-24)
* fix listVideoUtils title错乱问题
* fix setSpeed无法重置的问题
* 增加旋转使能后是否跟随系统设置
```
/**
* 是否更新系统旋转,false的话,系统禁止旋转也会跟着旋转
* @param rotateWithSystem 默认true
*/
public void setRotateWithSystem(boolean rotateWithSystem)
```
### 1.6.7(2017-06-16)
* fix bug #265,全屏按返回按键之后的虚拟按键显示问题
* so编译配置增加protocol crypto
......
......@@ -18,12 +18,14 @@ public class OrientationUtils {
private Activity activity;
private GSYBaseVideoPlayer gsyVideoPlayer;
private OrientationEventListener orientationEventListener;
private int screenType = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
private OrientationEventListener orientationEventListener;
private boolean mClick, mClickLand, mClickPort;
private int mIsLand;
private boolean mClick, mClickLand, mClickPort;
private boolean mEnable = true;
private boolean mRotateWithSystem = true; //是否跟随系统
/**
* @param activity
......@@ -40,7 +42,7 @@ public class OrientationUtils {
@Override
public void onOrientationChanged(int rotation) {
boolean autoRotateOn = (android.provider.Settings.System.getInt(activity.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1);
if (!autoRotateOn) {
if (!autoRotateOn && mRotateWithSystem) {
//if (mIsLand == 0) {
return;
//}
......@@ -213,4 +215,17 @@ public class OrientationUtils {
public void setScreenType(int screenType) {
this.screenType = screenType;
}
public boolean isRotateWithSystem() {
return mRotateWithSystem;
}
/**
* 是否更新系统旋转,false的话,系统禁止旋转也会跟着旋转
* @param rotateWithSystem 默认true
*/
public void setRotateWithSystem(boolean rotateWithSystem) {
this.mRotateWithSystem = rotateWithSystem;
}
}
......@@ -101,6 +101,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected boolean mShowPauseCover = true;//是否显示暂停图片
protected boolean mRotateWithSystem = true; //旋转使能后是否跟随系统设置
protected Context mContext;
protected String mOriginUrl; //原来的url
......@@ -211,6 +213,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
gsyVideoPlayer.setIfCurrentIsFullscreen(true);
mOrientationUtils = new OrientationUtils((Activity) context, gsyVideoPlayer);
mOrientationUtils.setEnable(mRotateViewAuto);
mOrientationUtils.setRotateWithSystem(mRotateWithSystem);
gsyVideoPlayer.mOrientationUtils = mOrientationUtils;
if (isShowFullAnimation()) {
......@@ -369,6 +372,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
gsyVideoPlayer.mRotate = mRotate;
gsyVideoPlayer.mShowPauseCover = mShowPauseCover;
gsyVideoPlayer.mSeekRatio = mSeekRatio;
gsyVideoPlayer.mRotateWithSystem = mRotateWithSystem;
gsyVideoPlayer.setUp(mOriginUrl, mCache, mCachePath, mMapHeadData, mObjects);
gsyVideoPlayer.setStateAndUi(mCurrentState);
gsyVideoPlayer.addTextureView();
......@@ -852,4 +856,17 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
return mSeekRatio;
}
public boolean isRotateWithSystem() {
return mRotateWithSystem;
}
/**
* 是否更新系统旋转,false的话,系统禁止旋转也会跟着旋转
* @param rotateWithSystem 默认true
*/
public void setRotateWithSystem(boolean rotateWithSystem) {
this.mRotateWithSystem = rotateWithSystem;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册