|
@@ -4,6 +4,7 @@ import static com.cooleshow.base.common.WebConstants.WEB_URL;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
+import android.content.pm.ActivityInfo;
|
|
|
import android.os.Handler;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
@@ -27,6 +28,7 @@ import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.service.PlayMusicService;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.utils.FileUtils;
|
|
|
+import com.cooleshow.base.utils.LOG;
|
|
|
import com.cooleshow.base.utils.MyFileUtils;
|
|
|
import com.cooleshow.base.utils.ToastUtil;
|
|
|
import com.cooleshow.base.utils.helper.WebParamsHelper;
|
|
@@ -82,6 +84,8 @@ public class AccompanyActivity extends BaseMVPActivity<ActivityAccompanyBinding,
|
|
|
private JSONObject baseJsonObject;
|
|
|
private Intent intentOne;
|
|
|
|
|
|
+ private boolean isNeedResetScreenOrientation = true;
|
|
|
+
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
camera = viewBinding.camera;
|
|
@@ -97,6 +101,10 @@ public class AccompanyActivity extends BaseMVPActivity<ActivityAccompanyBinding,
|
|
|
return;
|
|
|
}
|
|
|
int orientation = intent.getIntExtra("orientation", -1);
|
|
|
+ int c_orientation = intent.getIntExtra("c_orientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
+ isNeedResetScreenOrientation = c_orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
|
|
+ LOG.i("c_orientation:" + c_orientation + "--isNeedResetScreenOrientation:" + isNeedResetScreenOrientation);
|
|
|
+
|
|
|
boolean isOpenLight = intent.getBooleanExtra("isOpenLight", false);
|
|
|
|
|
|
if (isOpenLight) {
|
|
@@ -478,4 +486,29 @@ public class AccompanyActivity extends BaseMVPActivity<ActivityAccompanyBinding,
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void finish() {
|
|
|
+ //为了适配华为mata40曲面屏,此页面是横屏,前一页面是竖屏,返回回去的时候会有UI闪动,所以这样处理
|
|
|
+ //观察发现横屏模式时候没有达到曲面最大效果(竖屏可以达到),猜测横屏模式就不是曲面模式了,这个时候回到前面(竖屏)页面,屏幕的最外层的容器可能会变化导致UI闪动
|
|
|
+ checkScreenOrientation();
|
|
|
+ super.finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onBackPressed() {
|
|
|
+ //为了适配华为mata40曲面屏,此页面是横屏,前一页面是竖屏,返回回去的时候会有UI闪动,所以这样处理
|
|
|
+ //观察发现横屏模式时候没有达到曲面最大效果(竖屏可以达到),猜测横屏模式就不是曲面模式了,这个时候回到前面(竖屏)页面,屏幕的最外层的容器可能会变化导致UI闪动
|
|
|
+ checkScreenOrientation();
|
|
|
+ super.onBackPressed();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkScreenOrientation() {
|
|
|
+ LOG.i("isNeedResetScreenOrientation:" + isNeedResetScreenOrientation);
|
|
|
+ if (isNeedResetScreenOrientation) {
|
|
|
+ if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
|
|
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|