Browse Source

removed dud interface

Daniel Zlotin 8 years ago
parent
commit
464b30c144

+ 2
- 3
android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java View File

12
 import java.util.Arrays;
12
 import java.util.Arrays;
13
 import java.util.List;
13
 import java.util.List;
14
 
14
 
15
-public abstract class NavigationApplication extends Application implements NavigationReactInstance.ReactContextCreator {
15
+public abstract class NavigationApplication extends Application {
16
 
16
 
17
     public static NavigationApplication instance;
17
     public static NavigationApplication instance;
18
     private NavigationReactInstance navigationReactInstance;
18
     private NavigationReactInstance navigationReactInstance;
23
         super.onCreate();
23
         super.onCreate();
24
         instance = this;
24
         instance = this;
25
         handler = new Handler(getMainLooper());
25
         handler = new Handler(getMainLooper());
26
-        navigationReactInstance = new NavigationReactInstance(this);
26
+        navigationReactInstance = new NavigationReactInstance();
27
         navigationReactInstance.startReactContextOnceInBackgroundAndExecuteJS();
27
         navigationReactInstance.startReactContextOnceInBackgroundAndExecuteJS();
28
     }
28
     }
29
 
29
 
35
         return navigationReactInstance;
35
         return navigationReactInstance;
36
     }
36
     }
37
 
37
 
38
-    @Override
39
     public final List<ReactPackage> createReactPackages() {
38
     public final List<ReactPackage> createReactPackages() {
40
         List<ReactPackage> list = Arrays.asList(
39
         List<ReactPackage> list = Arrays.asList(
41
                 new MainReactPackage(),
40
                 new MainReactPackage(),

+ 6
- 12
android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInstance.java View File

11
 import com.reactnativenavigation.NavigationApplication;
11
 import com.reactnativenavigation.NavigationApplication;
12
 import com.reactnativenavigation.controllers.NavigationActivity;
12
 import com.reactnativenavigation.controllers.NavigationActivity;
13
 
13
 
14
-import java.util.List;
15
-
16
 public class NavigationReactInstance {
14
 public class NavigationReactInstance {
17
 
15
 
18
     private final ReactInstanceManager reactInstanceManager;
16
     private final ReactInstanceManager reactInstanceManager;
19
     private OnJsDevReloadListener onJsDevReloadListener;
17
     private OnJsDevReloadListener onJsDevReloadListener;
20
 
18
 
21
-    public interface ReactContextCreator {
22
-        List<ReactPackage> createReactPackages();
23
-    }
24
-
25
     public interface OnJsDevReloadListener {
19
     public interface OnJsDevReloadListener {
26
         void onJsDevReload();
20
         void onJsDevReload();
27
     }
21
     }
28
 
22
 
29
-    public NavigationReactInstance(final ReactContextCreator reactContextCreator) {
30
-        reactInstanceManager = createReactInstanceManager(reactContextCreator);
23
+    public NavigationReactInstance() {
24
+        reactInstanceManager = createReactInstanceManager();
31
 
25
 
32
         if (NavigationApplication.instance.isDebug()) {
26
         if (NavigationApplication.instance.isDebug()) {
33
-            replaceJsDevReloadListener(reactContextCreator);
27
+            replaceJsDevReloadListener();
34
         }
28
         }
35
     }
29
     }
36
 
30
 
75
         reactInstanceManager.onHostDestroy();
69
         reactInstanceManager.onHostDestroy();
76
     }
70
     }
77
 
71
 
78
-    private void replaceJsDevReloadListener(final ReactContextCreator reactContextCreator) {
72
+    private void replaceJsDevReloadListener() {
79
         new JsDevReloadListenerReplacer(reactInstanceManager, new JsDevReloadListenerReplacer.Listener() {
73
         new JsDevReloadListenerReplacer(reactInstanceManager, new JsDevReloadListenerReplacer.Listener() {
80
             @Override
74
             @Override
81
             public void onJsDevReload() {
75
             public void onJsDevReload() {
85
         }).replace();
79
         }).replace();
86
     }
80
     }
87
 
81
 
88
-    private ReactInstanceManager createReactInstanceManager(final ReactContextCreator reactContextCreator) {
82
+    private ReactInstanceManager createReactInstanceManager() {
89
         ReactInstanceManager.Builder builder = ReactInstanceManager.builder()
83
         ReactInstanceManager.Builder builder = ReactInstanceManager.builder()
90
                 .setApplication(NavigationApplication.instance)
84
                 .setApplication(NavigationApplication.instance)
91
                 .setJSMainModuleName(NavigationApplication.instance.getJsEntryFileName())
85
                 .setJSMainModuleName(NavigationApplication.instance.getJsEntryFileName())
93
                 .setUseDeveloperSupport(NavigationApplication.instance.isDebug())
87
                 .setUseDeveloperSupport(NavigationApplication.instance.isDebug())
94
                 .setInitialLifecycleState(LifecycleState.BEFORE_RESUME);
88
                 .setInitialLifecycleState(LifecycleState.BEFORE_RESUME);
95
 
89
 
96
-        for (ReactPackage reactPackage : reactContextCreator.createReactPackages()) {
90
+        for (ReactPackage reactPackage : NavigationApplication.instance.createReactPackages()) {
97
             builder.addPackage(reactPackage);
91
             builder.addPackage(reactPackage);
98
         }
92
         }
99
 
93