Browse Source

Minor cleanup

Guy Carmeli 5 years ago
parent
commit
6e3dca7358

+ 3
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ParentController.java View File

@@ -16,6 +16,8 @@ import com.reactnativenavigation.views.Component;
16 16
 
17 17
 import java.util.Collection;
18 18
 
19
+import static com.reactnativenavigation.utils.CollectionUtils.forEach;
20
+
19 21
 public abstract class ParentController<T extends ViewGroup> extends ChildController {
20 22
 
21 23
 	public ParentController(Activity activity, ChildControllersRegistry childRegistry, String id, Presenter presenter, Options initialOptions) {
@@ -31,12 +33,7 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
31 33
     @Override
32 34
     public void setDefaultOptions(Options defaultOptions) {
33 35
 	    super.setDefaultOptions(defaultOptions);
34
-        Collection<? extends ViewController> children = getChildControllers();
35
-        if (!CollectionUtils.isNullOrEmpty(children)) {
36
-            for (ViewController child : children) {
37
-                child.setDefaultOptions(defaultOptions);
38
-            }
39
-        }
36
+	    forEach(getChildControllers(), (child) -> child.setDefaultOptions(defaultOptions));
40 37
     }
41 38
 
42 39
     @Override

+ 0
- 12
playground/android/app/src/main/java/com/reactnativenavigation/playground/MainActivity.java View File

@@ -1,6 +1,5 @@
1 1
 package com.reactnativenavigation.playground;
2 2
 
3
-import android.content.Intent;
4 3
 import android.os.Bundle;
5 4
 import android.support.annotation.Nullable;
6 5
 import android.widget.ImageView;
@@ -20,15 +19,4 @@ public class MainActivity extends NavigationActivity {
20 19
         img.setImageDrawable(getDrawable(R.drawable.ic_android));
21 20
         setContentView(img);
22 21
     }
23
-
24
-    @Override
25
-    public void onWindowFocusChanged(boolean hasFocus) {
26
-        dismissSystemAlertsToPreventDetoxFromTimingOut(hasFocus);
27
-    }
28
-
29
-    private void dismissSystemAlertsToPreventDetoxFromTimingOut(boolean hasFocus) {
30
-        if (! hasFocus) {
31
-            sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
32
-        }
33
-    }
34 22
 }