|
|
@@ -94,10 +94,10 @@ public abstract class BaseActivity extends RxAppCompatActivity implements BackHa
|
|
|
// .penaltyDeath()
|
|
|
// .build());
|
|
|
// }
|
|
|
- if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O && isTranslucentOrFloating()) {
|
|
|
- boolean result = fixOrientation();
|
|
|
- LogUtil.println("onCreate fixOrientation when Oreo, result = " + result);
|
|
|
- }
|
|
|
+// if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O && isTranslucentOrFloating()) {
|
|
|
+// boolean result = fixOrientation();
|
|
|
+// LogUtil.println("onCreate fixOrientation when Oreo, result = " + result);
|
|
|
+// }
|
|
|
super.onCreate(savedInstanceState);
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
|
Window win = getWindow();
|
|
|
@@ -134,7 +134,7 @@ public abstract class BaseActivity extends RxAppCompatActivity implements BackHa
|
|
|
unbinder = ButterKnife.bind(this);
|
|
|
if (needRegisterEventBus())
|
|
|
EventBus.getDefault().register(this);
|
|
|
- initSlidr();
|
|
|
+// initSlidr();
|
|
|
}
|
|
|
protected int getTitleLayoutId(){
|
|
|
return R.layout.title;
|
|
|
@@ -349,44 +349,44 @@ public abstract class BaseActivity extends RxAppCompatActivity implements BackHa
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
- private boolean isTranslucentOrFloating(){
|
|
|
- if(TestUtil.isDev()){
|
|
|
- return false;
|
|
|
- }
|
|
|
- boolean isTranslucentOrFloating = false;
|
|
|
- try {
|
|
|
- int [] styleableRes = (int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null);
|
|
|
- final TypedArray ta = obtainStyledAttributes(styleableRes);
|
|
|
- Method m = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
|
|
|
- m.setAccessible(true);
|
|
|
- isTranslucentOrFloating = (boolean)m.invoke(null, ta);
|
|
|
- m.setAccessible(false);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return isTranslucentOrFloating;
|
|
|
- }
|
|
|
- private boolean fixOrientation(){
|
|
|
- try {
|
|
|
- Field field = Activity.class.getDeclaredField("mActivityInfo");
|
|
|
- field.setAccessible(true);
|
|
|
- ActivityInfo o = (ActivityInfo)field.get(this);
|
|
|
- o.screenOrientation = -1;
|
|
|
- field.setAccessible(false);
|
|
|
- return true;
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- @Override
|
|
|
- public void setRequestedOrientation(int requestedOrientation) {
|
|
|
- if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O && isTranslucentOrFloating()) {
|
|
|
- LogUtil.println("avoid calling setRequestedOrientation when Oreo.");
|
|
|
- return;
|
|
|
- }
|
|
|
- super.setRequestedOrientation(requestedOrientation);
|
|
|
- }
|
|
|
+// private boolean isTranslucentOrFloating(){
|
|
|
+// if(TestUtil.isDev()){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// boolean isTranslucentOrFloating = false;
|
|
|
+// try {
|
|
|
+// int [] styleableRes = (int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null);
|
|
|
+// final TypedArray ta = obtainStyledAttributes(styleableRes);
|
|
|
+// Method m = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
|
|
|
+// m.setAccessible(true);
|
|
|
+// isTranslucentOrFloating = (boolean)m.invoke(null, ta);
|
|
|
+// m.setAccessible(false);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return isTranslucentOrFloating;
|
|
|
+// }
|
|
|
+// private boolean fixOrientation(){
|
|
|
+// try {
|
|
|
+// Field field = Activity.class.getDeclaredField("mActivityInfo");
|
|
|
+// field.setAccessible(true);
|
|
|
+// ActivityInfo o = (ActivityInfo)field.get(this);
|
|
|
+// o.screenOrientation = -1;
|
|
|
+// field.setAccessible(false);
|
|
|
+// return true;
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// @Override
|
|
|
+// public void setRequestedOrientation(int requestedOrientation) {
|
|
|
+// if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O && isTranslucentOrFloating()) {
|
|
|
+// LogUtil.println("avoid calling setRequestedOrientation when Oreo.");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// super.setRequestedOrientation(requestedOrientation);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
private BaseFragment backHandleFragment;
|