Commit 675bbce4 authored by yangwu.jia's avatar yangwu.jia

Add getflutterview

parent 77af051a
...@@ -75,13 +75,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine ...@@ -75,13 +75,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
return flutterEngine; return flutterEngine;
} }
XFlutterView getFlutterView(){
return flutterView;
}
void onAttach(@NonNull Context context) { void onAttach(@NonNull Context context) {
ensureAlive(); ensureAlive();
if (NewFlutterBoost.instance().platform().whenEngineStart() == NewFlutterBoost.ConfigBuilder.FLUTTER_ACTIVITY_CREATED) { if (NewFlutterBoost.instance().platform().whenEngineStart() == NewFlutterBoost.ConfigBuilder.FLUTTER_ACTIVITY_CREATED) {
NewFlutterBoost.instance().doInitialFlutter(); NewFlutterBoost.instance().doInitialFlutter();
} }
// When "retain instance" is true, the FlutterEngine will survive configuration // When "retain instance" is true, the FlutterEngine will survive configuration
// changes. Therefore, we create a new one only if one does not already exist. // changes. Therefore, we create a new one only if one does not already exist.
if (flutterEngine == null) { if (flutterEngine == null) {
......
...@@ -21,6 +21,7 @@ import android.view.*; ...@@ -21,6 +21,7 @@ import android.view.*;
import android.widget.*; import android.widget.*;
import com.idlefish.flutterboost.NewFlutterBoost; import com.idlefish.flutterboost.NewFlutterBoost;
import com.idlefish.flutterboost.Utils; import com.idlefish.flutterboost.Utils;
import com.idlefish.flutterboost.XFlutterView;
import io.flutter.Log; import io.flutter.Log;
import io.flutter.embedding.android.DrawableSplashScreen; import io.flutter.embedding.android.DrawableSplashScreen;
import io.flutter.embedding.android.FlutterView; import io.flutter.embedding.android.FlutterView;
...@@ -243,7 +244,10 @@ public class NewBoostFlutterActivity extends Activity ...@@ -243,7 +244,10 @@ public class NewBoostFlutterActivity extends Activity
} }
}
protected XFlutterView getFlutterView(){
return delegate.getFlutterView();
} }
@Override @Override
......
...@@ -15,6 +15,7 @@ import android.view.View; ...@@ -15,6 +15,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.idlefish.flutterboost.NewFlutterBoost; import com.idlefish.flutterboost.NewFlutterBoost;
import com.idlefish.flutterboost.XFlutterView;
import io.flutter.embedding.android.*; import io.flutter.embedding.android.*;
import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.FlutterShellArgs; import io.flutter.embedding.engine.FlutterShellArgs;
...@@ -233,6 +234,10 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr ...@@ -233,6 +234,10 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
private FlutterActivityAndFragmentDelegate delegate; private FlutterActivityAndFragmentDelegate delegate;
protected XFlutterView getFlutterView(){
return delegate.getFlutterView();
}
public NewFlutterFragment() { public NewFlutterFragment() {
// Ensure that we at least have an empty Bundle of arguments so that we don't // Ensure that we at least have an empty Bundle of arguments so that we don't
// need to continually check for null arguments before grabbing one. // need to continually check for null arguments before grabbing one.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment