Permalink
Browse files

Move `getLaunchOptions` from ReactActivity to ReactActivityDelegate

Summary:
After 3c4fd42, `getLaunchOptions` no longer exists in class `ReactActivity`.
We need refactor UIExplorerActivity to fix the build error.
Closes #9320

Differential Revision: D3696381

Pulled By: astreet

fbshipit-source-id: 5700cf2363029a95cfbdaf6230e4f82ea69fb472
  • Loading branch information...
leeight authored and Facebook Github Bot 2 committed Aug 11, 2016
1 parent 7cdd4c9 commit 4963a37e804c0385af13d86424c74d2fdefb73f6
@@ -14,32 +14,49 @@
package com.facebook.react.uiapp;
+import android.app.Activity;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
+import com.facebook.react.ReactActivityDelegate;
+
+import javax.annotation.Nullable;
public class UIExplorerActivity extends ReactActivity {
- private final String PARAM_ROUTE = "route";
- private Bundle mInitialProps = null;
+ public static class UIExplorerActivityDelegate extends ReactActivityDelegate {
+ private static final String PARAM_ROUTE = "route";
+ private Bundle mInitialProps = null;
+ private final @Nullable Activity mActivity;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- // Get remote param before calling super which uses it
- Bundle bundle = getIntent().getExtras();
- if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
- String routeUri = new StringBuilder("rnuiexplorer://example/")
- .append(bundle.getString(PARAM_ROUTE))
- .append("Example")
- .toString();
- mInitialProps = new Bundle();
- mInitialProps.putString("exampleFromAppetizeParams", routeUri);
+ public UIExplorerActivityDelegate(Activity activity, String mainComponentName) {
+ super(activity, mainComponentName);
+ this.mActivity = activity;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // Get remote param before calling super which uses it
+ Bundle bundle = mActivity.getIntent().getExtras();
+ if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
+ String routeUri = new StringBuilder("rnuiexplorer://example/")
+ .append(bundle.getString(PARAM_ROUTE))
+ .append("Example")
+ .toString();
+ mInitialProps = new Bundle();
+ mInitialProps.putString("exampleFromAppetizeParams", routeUri);
+ }
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected Bundle getLaunchOptions() {
+ return mInitialProps;
}
- super.onCreate(savedInstanceState);
}
@Override
- protected Bundle getLaunchOptions() {
- return mInitialProps;
+ protected ReactActivityDelegate createReactActivityDelegate() {
+ return new UIExplorerActivityDelegate(this, getMainComponentName());
}
@Override

0 comments on commit 4963a37

Please sign in to comment.