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
 
16
 
17
 import java.util.Collection;
17
 import java.util.Collection;
18
 
18
 
19
+import static com.reactnativenavigation.utils.CollectionUtils.forEach;
20
+
19
 public abstract class ParentController<T extends ViewGroup> extends ChildController {
21
 public abstract class ParentController<T extends ViewGroup> extends ChildController {
20
 
22
 
21
 	public ParentController(Activity activity, ChildControllersRegistry childRegistry, String id, Presenter presenter, Options initialOptions) {
23
 	public ParentController(Activity activity, ChildControllersRegistry childRegistry, String id, Presenter presenter, Options initialOptions) {
31
     @Override
33
     @Override
32
     public void setDefaultOptions(Options defaultOptions) {
34
     public void setDefaultOptions(Options defaultOptions) {
33
 	    super.setDefaultOptions(defaultOptions);
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
     @Override
39
     @Override

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

1
 package com.reactnativenavigation.playground;
1
 package com.reactnativenavigation.playground;
2
 
2
 
3
-import android.content.Intent;
4
 import android.os.Bundle;
3
 import android.os.Bundle;
5
 import android.support.annotation.Nullable;
4
 import android.support.annotation.Nullable;
6
 import android.widget.ImageView;
5
 import android.widget.ImageView;
20
         img.setImageDrawable(getDrawable(R.drawable.ic_android));
19
         img.setImageDrawable(getDrawable(R.drawable.ic_android));
21
         setContentView(img);
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
 }