|
@@ -1,6 +1,5 @@
|
1
|
1
|
package com.reactnativenavigation.presentation;
|
2
|
2
|
|
3
|
|
-import android.view.View;
|
4
|
3
|
import android.view.ViewGroup;
|
5
|
4
|
|
6
|
5
|
import com.reactnativenavigation.viewcontrollers.ViewController;
|
|
@@ -8,15 +7,21 @@ import com.reactnativenavigation.viewcontrollers.ViewController;
|
8
|
7
|
import java.util.HashMap;
|
9
|
8
|
|
10
|
9
|
public class OverlayManager {
|
11
|
|
- private final HashMap<String, View> overlayRegistry = new HashMap<>();
|
|
10
|
+ private final HashMap<String, ViewController> overlayRegistry = new HashMap<>();
|
12
|
11
|
|
13
|
12
|
public void show(ViewGroup root, ViewController overlay) {
|
14
|
|
- View view = overlay.getView();
|
15
|
|
- overlayRegistry.put(overlay.getId(), view);
|
16
|
|
- root.addView(view);
|
|
13
|
+ overlayRegistry.put(overlay.getId(), overlay);
|
|
14
|
+ root.addView(overlay.getView());
|
17
|
15
|
}
|
18
|
16
|
|
19
|
17
|
public void dismiss(ViewGroup root, String componentId) {
|
20
|
|
- root.removeView(overlayRegistry.get(componentId));
|
|
18
|
+ root.removeView(overlayRegistry.get(componentId).getView());
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ public void destroy() {
|
|
22
|
+ for (ViewController view : overlayRegistry.values()) {
|
|
23
|
+ view.destroy();
|
|
24
|
+ }
|
|
25
|
+ overlayRegistry.clear();
|
21
|
26
|
}
|
22
|
27
|
}
|