remove activities from module constructors

Summary:
Refactor modules that take activities (or activities that implement some interface) as constructor args to not do that. Expose `getCurrentActivity()` in `ReactContext` and use that wherever the activity is needed.

public

Reviewed By: astreet

Differential Revision: D2680462

fb-gh-sync-id: f263b3fe5b422b7aab9fdadd051cef4e82797b0a
This commit is contained in:
Felix Oghina
2015-12-02 09:10:28 -08:00
committed by facebook-github-bot-9
parent 7ab17e5ef3
commit c06efc0831
4 changed files with 58 additions and 2 deletions

View File

@@ -47,6 +47,18 @@ import com.facebook.react.uimanager.ViewManager;
* have a static method, and so cannot (in Java < 8), be one.
*/
public abstract class ReactInstanceManager {
/**
* Listener interface for react instance events.
*/
public interface ReactInstanceEventListener {
/**
* Called when the react context is initialized (all modules registered). Always called on the
* UI thread.
*/
void onReactContextInitialized(ReactContext context);
}
public abstract DevSupportManager getDevSupportManager();
/**
@@ -118,6 +130,11 @@ public abstract class ReactInstanceManager {
public abstract List<ViewManager> createAllViewManagers(
ReactApplicationContext catalystApplicationContext);
/**
* Add a listener to be notified of react instance events.
*/
public abstract void addReactInstanceEventListener(ReactInstanceEventListener listener);
@VisibleForTesting
public abstract @Nullable ReactContext getCurrentReactContext();