Commit 68eb77b539ea6195395d4fbe84f677afd011cbff
1 parent
3956d380
1.禁止拍摄页面横屏
Showing
5 changed files
with
20 additions
and
19 deletions
config.gradle
lib_media/src/main/AndroidManifest.xml
| @@ -25,10 +25,13 @@ | @@ -25,10 +25,13 @@ | ||
| 25 | android:windowSoftInputMode="stateAlwaysHidden" /> | 25 | android:windowSoftInputMode="stateAlwaysHidden" /> |
| 26 | <activity | 26 | <activity |
| 27 | android:name="com.cnlive.media.ui.activity.RecordActivity" | 27 | android:name="com.cnlive.media.ui.activity.RecordActivity" |
| 28 | - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout" | 28 | + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden" |
| 29 | android:launchMode="singleTop" | 29 | android:launchMode="singleTop" |
| 30 | - android:theme="@style/FullActivityThemeStyle" | ||
| 31 | - android:windowSoftInputMode="stateAlwaysHidden" /> | 30 | + android:screenOrientation="portrait"> |
| 31 | + <meta-data | ||
| 32 | + android:name="android.notch_support" | ||
| 33 | + android:value="true" /> | ||
| 34 | + </activity> | ||
| 32 | <activity | 35 | <activity |
| 33 | android:name="com.cnlive.media.ui.activity.ImageCropActivity" | 36 | android:name="com.cnlive.media.ui.activity.ImageCropActivity" |
| 34 | android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout" | 37 | android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout" |
lib_media/src/main/java/com/cnlive/media/ui/activity/RecordActivity.java
| @@ -7,6 +7,7 @@ import android.content.Intent; | @@ -7,6 +7,7 @@ import android.content.Intent; | ||
| 7 | import android.graphics.Bitmap; | 7 | import android.graphics.Bitmap; |
| 8 | import android.graphics.Color; | 8 | import android.graphics.Color; |
| 9 | import android.os.Bundle; | 9 | import android.os.Bundle; |
| 10 | +import android.view.WindowManager; | ||
| 10 | 11 | ||
| 11 | import androidx.annotation.NonNull; | 12 | import androidx.annotation.NonNull; |
| 12 | import androidx.fragment.app.Fragment; | 13 | import androidx.fragment.app.Fragment; |
| @@ -42,7 +43,6 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | @@ -42,7 +43,6 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | ||
| 42 | 43 | ||
| 43 | 44 | ||
| 44 | public ImagePickerOptions mOptions; | 45 | public ImagePickerOptions mOptions; |
| 45 | - public boolean isInit = false; | ||
| 46 | public Bitmap preBitmap; | 46 | public Bitmap preBitmap; |
| 47 | public String videoPath; | 47 | public String videoPath; |
| 48 | public int resultCode; | 48 | public int resultCode; |
| @@ -75,11 +75,14 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | @@ -75,11 +75,14 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | ||
| 75 | protected void onCreate(Bundle savedInstanceState) { | 75 | protected void onCreate(Bundle savedInstanceState) { |
| 76 | super.onCreate(savedInstanceState); | 76 | super.onCreate(savedInstanceState); |
| 77 | this.getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT); | 77 | this.getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT); |
| 78 | - StatusBarUtil2.setTransparentForWindow(this); | ||
| 79 | - StatusBarUtil2.addTranslucentView(this, 0); | ||
| 80 | - QiniuVideoUtil.chcekInitState(this, isInit -> { | ||
| 81 | - if (isInit) { | ||
| 82 | - | 78 | + //设置全屏,不延伸到刘海屏 |
| 79 | + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
| 80 | + if (getSupportActionBar() != null) getSupportActionBar().hide(); | ||
| 81 | + QiniuVideoUtil.chcekInitState(this, state -> { | ||
| 82 | + if (state == 0) { | ||
| 83 | + getMvpView().showMessage("功能维护中"); | ||
| 84 | + onBackPressed(); | ||
| 85 | + } else if (state == 1) { | ||
| 83 | if (savedInstanceState != null) { | 86 | if (savedInstanceState != null) { |
| 84 | mOptions = savedInstanceState.getParcelable(PickerConfig.INTENT_KEY_OPTIONS); | 87 | mOptions = savedInstanceState.getParcelable(PickerConfig.INTENT_KEY_OPTIONS); |
| 85 | resultCode = savedInstanceState.getInt(PickerConfig.RESULT_CODE, resultCode); | 88 | resultCode = savedInstanceState.getInt(PickerConfig.RESULT_CODE, resultCode); |
| @@ -105,7 +108,7 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | @@ -105,7 +108,7 @@ public class RecordActivity extends MvpBindingActivity<RecordView, RecordPresent | ||
| 105 | 108 | ||
| 106 | if (getMvpView() != null) getMvpView().initView(); | 109 | if (getMvpView() != null) getMvpView().initView(); |
| 107 | } else { | 110 | } else { |
| 108 | - getMvpView().showMessage("初始化异常"); | 111 | + getMvpView().showMessage("网络故障"); |
| 109 | onBackPressed(); | 112 | onBackPressed(); |
| 110 | } | 113 | } |
| 111 | 114 |
lib_media/src/main/java/com/cnlive/media/utils/QiniuVideoUtil.java
| @@ -29,16 +29,11 @@ public class QiniuVideoUtil { | @@ -29,16 +29,11 @@ public class QiniuVideoUtil { | ||
| 29 | */ | 29 | */ |
| 30 | public static void chcekInitState(Context context, QiniuVideoInitListener listener) { | 30 | public static void chcekInitState(Context context, QiniuVideoInitListener listener) { |
| 31 | PLShortVideoEnv.checkAuthentication(context, i -> { | 31 | PLShortVideoEnv.checkAuthentication(context, i -> { |
| 32 | - if (i==1){ | ||
| 33 | - listener.isInitState(true); | ||
| 34 | - }else { | ||
| 35 | - listener.isInitState(false); | ||
| 36 | - } | ||
| 37 | - | 32 | + listener.isInitState(i); |
| 38 | }); | 33 | }); |
| 39 | } | 34 | } |
| 40 | 35 | ||
| 41 | public interface QiniuVideoInitListener{ | 36 | public interface QiniuVideoInitListener{ |
| 42 | - void isInitState(boolean isInit); | 37 | + void isInitState(int state); |
| 43 | } | 38 | } |
| 44 | } | 39 | } |
lib_media/src/main/res/layout/activity_record.xml
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | android:id="@+id/pre_frame" | 10 | android:id="@+id/pre_frame" |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="match_parent" | 12 | android:layout_height="match_parent" |
| 13 | - android:background="@color/transparent" /> | 13 | + android:background="@color/black" /> |
| 14 | 14 | ||
| 15 | </RelativeLayout> | 15 | </RelativeLayout> |
| 16 | </layout> | 16 | </layout> |
| 17 | \ No newline at end of file | 17 | \ No newline at end of file |