6868 * <p>The following illustrates how to pre-warm and cache a {@link FlutterEngine}:
6969 *
7070 * <pre>{@code
71- * // Create and pre-warm a FlutterEngine. FlutterEngine flutterEngine = new
72- * FlutterEngine(context);
73- * flutterEngine.getDartExecutor().executeDartEntrypoint(DartEntrypoint.createDefault());
71+ * // Create and pre-warm a FlutterEngine.
72+ * FlutterEngine flutterEngine = new FlutterEngine(context);
73+ * flutterEngine
74+ * .getDartExecutor()
75+ * .executeDartEntrypoint(DartEntrypoint.createDefault());
7476 *
7577 * // Cache the pre-warmed FlutterEngine in the FlutterEngineCache.
7678 * FlutterEngineCache.getInstance().put("my_engine", flutterEngine);
@@ -91,14 +93,10 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
9193 protected static final String ARG_APP_BUNDLE_PATH = "app_bundle_path" ;
9294 /** Flutter shell arguments. */
9395 protected static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args" ;
94- /**
95- * {@link FlutterView.RenderMode} to be used for the {@link FlutterView} in this {@code
96- * FlutterFragment}
97- */
96+ /** {@link RenderMode} to be used for the {@link FlutterView} in this {@code FlutterFragment} */
9897 protected static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode" ;
9998 /**
100- * {@link FlutterView.TransparencyMode} to be used for the {@link FlutterView} in this {@code
101- * FlutterFragment}
99+ * {@link TransparencyMode} to be used for the {@link FlutterView} in this {@code FlutterFragment}
102100 */
103101 protected static final String ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode" ;
104102 /** See {@link #shouldAttachEngineToActivity()}. */
@@ -185,9 +183,8 @@ public static class NewEngineFragmentBuilder {
185183 private String initialRoute = "/" ;
186184 private String appBundlePath = null ;
187185 private FlutterShellArgs shellArgs = null ;
188- private FlutterView .RenderMode renderMode = FlutterView .RenderMode .surface ;
189- private FlutterView .TransparencyMode transparencyMode =
190- FlutterView .TransparencyMode .transparent ;
186+ private RenderMode renderMode = RenderMode .surface ;
187+ private TransparencyMode transparencyMode = TransparencyMode .transparent ;
191188 private boolean shouldAttachEngineToActivity = true ;
192189
193190 /**
@@ -241,27 +238,25 @@ public NewEngineFragmentBuilder flutterShellArgs(@NonNull FlutterShellArgs shell
241238 }
242239
243240 /**
244- * Render Flutter either as a {@link FlutterView.RenderMode#surface} or a {@link
245- * FlutterView.RenderMode#texture}. You should use {@code surface} unless you have a specific
246- * reason to use {@code texture}. {@code texture} comes with a significant performance impact,
247- * but {@code texture} can be displayed beneath other Android {@code View}s and animated,
248- * whereas {@code surface} cannot.
241+ * Render Flutter either as a {@link RenderMode#surface} or a {@link RenderMode#texture}. You
242+ * should use {@code surface} unless you have a specific reason to use {@code texture}. {@code
243+ * texture} comes with a significant performance impact, but {@code texture} can be displayed
244+ * beneath other Android {@code View}s and animated, whereas {@code surface} cannot.
249245 */
250246 @ NonNull
251- public NewEngineFragmentBuilder renderMode (@ NonNull FlutterView . RenderMode renderMode ) {
247+ public NewEngineFragmentBuilder renderMode (@ NonNull RenderMode renderMode ) {
252248 this .renderMode = renderMode ;
253249 return this ;
254250 }
255251
256252 /**
257- * Support a {@link FlutterView. TransparencyMode#transparent} background within {@link
258- * FlutterView}, or force an {@link FlutterView. TransparencyMode#opaque} background.
253+ * Support a {@link TransparencyMode#transparent} background within {@link FlutterView}, or
254+ * force an {@link TransparencyMode#opaque} background.
259255 *
260- * <p>See {@link FlutterView. TransparencyMode} for implications of this selection.
256+ * <p>See {@link TransparencyMode} for implications of this selection.
261257 */
262258 @ NonNull
263- public NewEngineFragmentBuilder transparencyMode (
264- @ NonNull FlutterView .TransparencyMode transparencyMode ) {
259+ public NewEngineFragmentBuilder transparencyMode (@ NonNull TransparencyMode transparencyMode ) {
265260 this .transparencyMode = transparencyMode ;
266261 return this ;
267262 }
@@ -326,12 +321,10 @@ protected Bundle createArgs() {
326321 }
327322 args .putString (
328323 ARG_FLUTTERVIEW_RENDER_MODE ,
329- renderMode != null ? renderMode .name () : FlutterView . RenderMode .surface .name ());
324+ renderMode != null ? renderMode .name () : RenderMode .surface .name ());
330325 args .putString (
331326 ARG_FLUTTERVIEW_TRANSPARENCY_MODE ,
332- transparencyMode != null
333- ? transparencyMode .name ()
334- : FlutterView .TransparencyMode .transparent .name ());
327+ transparencyMode != null ? transparencyMode .name () : TransparencyMode .transparent .name ());
335328 args .putBoolean (ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY , shouldAttachEngineToActivity );
336329 args .putBoolean (ARG_DESTROY_ENGINE_WITH_FRAGMENT , true );
337330 return args ;
@@ -412,9 +405,8 @@ public static class CachedEngineFragmentBuilder {
412405 private final Class <? extends FlutterFragment > fragmentClass ;
413406 private final String engineId ;
414407 private boolean destroyEngineWithFragment = false ;
415- private FlutterView .RenderMode renderMode = FlutterView .RenderMode .surface ;
416- private FlutterView .TransparencyMode transparencyMode =
417- FlutterView .TransparencyMode .transparent ;
408+ private RenderMode renderMode = RenderMode .surface ;
409+ private TransparencyMode transparencyMode = TransparencyMode .transparent ;
418410 private boolean shouldAttachEngineToActivity = true ;
419411
420412 private CachedEngineFragmentBuilder (@ NonNull String engineId ) {
@@ -440,27 +432,26 @@ public CachedEngineFragmentBuilder destroyEngineWithFragment(
440432 }
441433
442434 /**
443- * Render Flutter either as a {@link FlutterView.RenderMode#surface} or a {@link
444- * FlutterView.RenderMode#texture}. You should use {@code surface} unless you have a specific
445- * reason to use {@code texture}. {@code texture} comes with a significant performance impact,
446- * but {@code texture} can be displayed beneath other Android {@code View}s and animated,
447- * whereas {@code surface} cannot.
435+ * Render Flutter either as a {@link RenderMode#surface} or a {@link RenderMode#texture}. You
436+ * should use {@code surface} unless you have a specific reason to use {@code texture}. {@code
437+ * texture} comes with a significant performance impact, but {@code texture} can be displayed
438+ * beneath other Android {@code View}s and animated, whereas {@code surface} cannot.
448439 */
449440 @ NonNull
450- public CachedEngineFragmentBuilder renderMode (@ NonNull FlutterView . RenderMode renderMode ) {
441+ public CachedEngineFragmentBuilder renderMode (@ NonNull RenderMode renderMode ) {
451442 this .renderMode = renderMode ;
452443 return this ;
453444 }
454445
455446 /**
456- * Support a {@link FlutterView. TransparencyMode#transparent} background within {@link
457- * FlutterView}, or force an {@link FlutterView. TransparencyMode#opaque} background.
447+ * Support a {@link TransparencyMode#transparent} background within {@link FlutterView}, or
448+ * force an {@link TransparencyMode#opaque} background.
458449 *
459- * <p>See {@link FlutterView. TransparencyMode} for implications of this selection.
450+ * <p>See {@link TransparencyMode} for implications of this selection.
460451 */
461452 @ NonNull
462453 public CachedEngineFragmentBuilder transparencyMode (
463- @ NonNull FlutterView . TransparencyMode transparencyMode ) {
454+ @ NonNull TransparencyMode transparencyMode ) {
464455 this .transparencyMode = transparencyMode ;
465456 return this ;
466457 }
@@ -519,12 +510,10 @@ protected Bundle createArgs() {
519510 args .putBoolean (ARG_DESTROY_ENGINE_WITH_FRAGMENT , destroyEngineWithFragment );
520511 args .putString (
521512 ARG_FLUTTERVIEW_RENDER_MODE ,
522- renderMode != null ? renderMode .name () : FlutterView . RenderMode .surface .name ());
513+ renderMode != null ? renderMode .name () : RenderMode .surface .name ());
523514 args .putString (
524515 ARG_FLUTTERVIEW_TRANSPARENCY_MODE ,
525- transparencyMode != null
526- ? transparencyMode .name ()
527- : FlutterView .TransparencyMode .transparent .name ());
516+ transparencyMode != null ? transparencyMode .name () : TransparencyMode .transparent .name ());
528517 args .putBoolean (ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY , shouldAttachEngineToActivity );
529518 return args ;
530519 }
@@ -832,38 +821,36 @@ public String getInitialRoute() {
832821 }
833822
834823 /**
835- * Returns the desired {@link FlutterView. RenderMode} for the {@link FlutterView} displayed in
836- * this {@code FlutterFragment}.
824+ * Returns the desired {@link RenderMode} for the {@link FlutterView} displayed in this {@code
825+ * FlutterFragment}.
837826 *
838- * <p>Defaults to {@link FlutterView. RenderMode#surface}.
827+ * <p>Defaults to {@link RenderMode#surface}.
839828 *
840829 * <p>Used by this {@code FlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host}
841830 */
842831 @ Override
843832 @ NonNull
844- public FlutterView . RenderMode getRenderMode () {
833+ public RenderMode getRenderMode () {
845834 String renderModeName =
846- getArguments ()
847- .getString (ARG_FLUTTERVIEW_RENDER_MODE , FlutterView .RenderMode .surface .name ());
848- return FlutterView .RenderMode .valueOf (renderModeName );
835+ getArguments ().getString (ARG_FLUTTERVIEW_RENDER_MODE , RenderMode .surface .name ());
836+ return RenderMode .valueOf (renderModeName );
849837 }
850838
851839 /**
852- * Returns the desired {@link FlutterView. TransparencyMode} for the {@link FlutterView} displayed
853- * in this {@code FlutterFragment}.
840+ * Returns the desired {@link TransparencyMode} for the {@link FlutterView} displayed in this
841+ * {@code FlutterFragment}.
854842 *
855- * <p>Defaults to {@link FlutterView. TransparencyMode#transparent}.
843+ * <p>Defaults to {@link TransparencyMode#transparent}.
856844 *
857845 * <p>Used by this {@code FlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host}
858846 */
859847 @ Override
860848 @ NonNull
861- public FlutterView . TransparencyMode getTransparencyMode () {
849+ public TransparencyMode getTransparencyMode () {
862850 String transparencyModeName =
863851 getArguments ()
864- .getString (
865- ARG_FLUTTERVIEW_TRANSPARENCY_MODE , FlutterView .TransparencyMode .transparent .name ());
866- return FlutterView .TransparencyMode .valueOf (transparencyModeName );
852+ .getString (ARG_FLUTTERVIEW_TRANSPARENCY_MODE , TransparencyMode .transparent .name ());
853+ return TransparencyMode .valueOf (transparencyModeName );
867854 }
868855
869856 @ Override
@@ -983,6 +970,16 @@ public boolean shouldAttachEngineToActivity() {
983970 return getArguments ().getBoolean (ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY );
984971 }
985972
973+ @ Override
974+ public void onFlutterSurfaceViewCreated (@ NonNull FlutterSurfaceView flutterSurfaceView ) {
975+ // Hook for subclasses.
976+ }
977+
978+ @ Override
979+ public void onFlutterTextureViewCreated (@ NonNull FlutterTextureView flutterTextureView ) {
980+ // Hook for subclasses.
981+ }
982+
986983 /**
987984 * Invoked after the {@link FlutterView} within this {@code FlutterFragment} starts rendering
988985 * pixels to the screen.
0 commit comments