소스 검색

Dismiss system alerts in playground app

Hopefully, this will prevent Detox from timing out when a system alert pops up on the screen.
Guy Carmeli 6 년 전
부모
커밋
a7391bb664
1개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 13
    1
      playground/android/app/src/main/java/com/reactnativenavigation/playground/MainActivity.java

+ 13
- 1
playground/android/app/src/main/java/com/reactnativenavigation/playground/MainActivity.java 파일 보기

@@ -1,6 +1,18 @@
1 1
 package com.reactnativenavigation.playground;
2 2
 
3
-import com.reactnativenavigation.*;
3
+import android.content.Intent;
4
+
5
+import com.reactnativenavigation.NavigationActivity;
4 6
 
5 7
 public class MainActivity extends NavigationActivity {
8
+    @Override
9
+    public void onWindowFocusChanged(boolean hasFocus) {
10
+        dismissSystemAlertsToPreventDetoxFromTimingOut(hasFocus);
11
+    }
12
+
13
+    private void dismissSystemAlertsToPreventDetoxFromTimingOut(boolean hasFocus) {
14
+        if (! hasFocus) {
15
+            sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
16
+        }
17
+    }
6 18
 }