Commit 68eb77b539ea6195395d4fbe84f677afd011cbff

Authored by 朱显松
1 parent 3956d380

1.禁止拍摄页面横屏

config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "1.0.9",
  24 + version: "1.1.0",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.media",
27 27 //Lib库名称
... ...
lib_media/src/main/AndroidManifest.xml
... ... @@ -25,10 +25,13 @@
25 25 android:windowSoftInputMode="stateAlwaysHidden" />
26 26 <activity
27 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 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 35 <activity
33 36 android:name="com.cnlive.media.ui.activity.ImageCropActivity"
34 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 7 import android.graphics.Bitmap;
8 8 import android.graphics.Color;
9 9 import android.os.Bundle;
  10 +import android.view.WindowManager;
10 11  
11 12 import androidx.annotation.NonNull;
12 13 import androidx.fragment.app.Fragment;
... ... @@ -42,7 +43,6 @@ public class RecordActivity extends MvpBindingActivity&lt;RecordView, RecordPresent
42 43  
43 44  
44 45 public ImagePickerOptions mOptions;
45   - public boolean isInit = false;
46 46 public Bitmap preBitmap;
47 47 public String videoPath;
48 48 public int resultCode;
... ... @@ -75,11 +75,14 @@ public class RecordActivity extends MvpBindingActivity&lt;RecordView, RecordPresent
75 75 protected void onCreate(Bundle savedInstanceState) {
76 76 super.onCreate(savedInstanceState);
77 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 86 if (savedInstanceState != null) {
84 87 mOptions = savedInstanceState.getParcelable(PickerConfig.INTENT_KEY_OPTIONS);
85 88 resultCode = savedInstanceState.getInt(PickerConfig.RESULT_CODE, resultCode);
... ... @@ -105,7 +108,7 @@ public class RecordActivity extends MvpBindingActivity&lt;RecordView, RecordPresent
105 108  
106 109 if (getMvpView() != null) getMvpView().initView();
107 110 } else {
108   - getMvpView().showMessage("初始化异常");
  111 + getMvpView().showMessage("网络故障");
109 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 29 */
30 30 public static void chcekInitState(Context context, QiniuVideoInitListener listener) {
31 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 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 10 android:id="@+id/pre_frame"
11 11 android:layout_width="match_parent"
12 12 android:layout_height="match_parent"
13   - android:background="@color/transparent" />
  13 + android:background="@color/black" />
14 14  
15 15 </RelativeLayout>
16 16 </layout>
17 17 \ No newline at end of file
... ...