|
@@ -1,6 +1,7 @@
|
|
|
package com.cooleshow.musicmerge.ui;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
+import android.content.pm.ActivityInfo;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.Gravity;
|
|
@@ -44,7 +45,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
|
|
public class SelectVideoFrameActivity extends BaseMVPActivity<AcSelectVideoFrameLayoutBinding, VideoFileHandlePresenter> implements VideoFileHandleContract, View.OnClickListener {
|
|
|
private final static String OUT_PATH = MyFileUtils.getCacheDir(Utils.getApp(), "videoFrame");
|
|
|
private String mVideoPath;
|
|
|
-
|
|
|
+ private boolean isNeedResetScreenOrientation = true;
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "编辑封面");
|
|
@@ -64,6 +65,8 @@ public class SelectVideoFrameActivity extends BaseMVPActivity<AcSelectVideoFrame
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
super.initData();
|
|
|
+ int c_orientation = getIntent().getIntExtra("c_orientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
+ isNeedResetScreenOrientation = c_orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
|
|
mVideoPath = getIntent().getStringExtra("videoFilePath");
|
|
|
boolean isLocalFile = getIntent().getBooleanExtra("isLocalFile", true);
|
|
|
if (TextUtils.isEmpty(mVideoPath)) {
|
|
@@ -227,11 +230,17 @@ public class SelectVideoFrameActivity extends BaseMVPActivity<AcSelectVideoFrame
|
|
|
|
|
|
@Override
|
|
|
public void finish() {
|
|
|
+ //为了适配华为mata40曲面屏,此页面是横屏,前一页面是竖屏,返回回去的时候会有UI闪动,所以这样处理
|
|
|
+ //观察发现横屏模式时候没有达到曲面最大效果(竖屏可以达到),猜测横屏模式就不是曲面模式了,这个时候回到前面(竖屏)页面,屏幕的最外层的容器可能会变化导致UI闪动
|
|
|
+ checkScreenOrientation();
|
|
|
super.finish();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onBackPressed() {
|
|
|
+ //为了适配华为mata40曲面屏,此页面是横屏,前一页面是竖屏,返回回去的时候会有UI闪动,所以这样处理
|
|
|
+ //观察发现横屏模式时候没有达到曲面最大效果(竖屏可以达到),猜测横屏模式就不是曲面模式了,这个时候回到前面(竖屏)页面,屏幕的最外层的容器可能会变化导致UI闪动
|
|
|
+ checkScreenOrientation();
|
|
|
super.onBackPressed();
|
|
|
}
|
|
|
|
|
@@ -273,4 +282,13 @@ public class SelectVideoFrameActivity extends BaseMVPActivity<AcSelectVideoFrame
|
|
|
showLoading("获取封面中");
|
|
|
viewBinding.videoCutterLayout.getCover();
|
|
|
}
|
|
|
+
|
|
|
+ private void checkScreenOrientation() {
|
|
|
+ LOG.i("isNeedResetScreenOrientation:" + isNeedResetScreenOrientation);
|
|
|
+ if (isNeedResetScreenOrientation) {
|
|
|
+ if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
|
|
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|