Class FlutterActivity.CachedEngineIntentBuilder
- java.lang.Object
-
- io.flutter.embedding.android.FlutterActivity.CachedEngineIntentBuilder
-
- Enclosing class:
- FlutterActivity
public static class FlutterActivity.CachedEngineIntentBuilder extends Object
Builder to create anIntentthat launches aFlutterActivitywith an existingFlutterEnginethat is cached inFlutterEngineCache.
-
-
Constructor Summary
Constructors Constructor Description CachedEngineIntentBuilder(Class<? extends FlutterActivity> activityClass, String engineId)Constructor that allows thisCachedEngineIntentBuilderto be used by subclasses ofFlutterActivity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlutterActivity.CachedEngineIntentBuilderbackgroundMode(FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)The mode ofFlutterActivity's background, eitherFlutterActivityLaunchConfigs.BackgroundMode.opaqueorFlutterActivityLaunchConfigs.BackgroundMode.transparent.Intentbuild(Context context)Creates and returns anIntentthat will launch aFlutterActivitywith the desired configuration.FlutterActivity.CachedEngineIntentBuilderdestroyEngineWithActivity(boolean destroyEngineWithActivity)Whether the cachedFlutterEngineshould be destroyed and removed from the cache when thisFlutterActivityis destroyed.
-
-
-
Constructor Detail
-
CachedEngineIntentBuilder
public CachedEngineIntentBuilder(@NonNull Class<? extends FlutterActivity> activityClass, @NonNull String engineId)Constructor that allows thisCachedEngineIntentBuilderto be used by subclasses ofFlutterActivity.Subclasses of
FlutterActivityshould provide their own static version ofFlutterActivity.withCachedEngine(String), which returns an instance ofCachedEngineIntentBuilderconstructed with aClassreference to theFlutterActivitysubclass, e.g.:return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId);- Parameters:
activityClass- A subclass ofFlutterActivity.engineId- The engine id.
-
-
Method Detail
-
destroyEngineWithActivity
public FlutterActivity.CachedEngineIntentBuilder destroyEngineWithActivity(boolean destroyEngineWithActivity)
Whether the cachedFlutterEngineshould be destroyed and removed from the cache when thisFlutterActivityis destroyed.The default value is
false.- Parameters:
destroyEngineWithActivity- Whether to destroy the engine.- Returns:
- The builder.
-
backgroundMode
@NonNull public FlutterActivity.CachedEngineIntentBuilder backgroundMode(@NonNull FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)
The mode ofFlutterActivity's background, eitherFlutterActivityLaunchConfigs.BackgroundMode.opaqueorFlutterActivityLaunchConfigs.BackgroundMode.transparent.The default background mode is
FlutterActivityLaunchConfigs.BackgroundMode.opaque.Choosing a background mode of
FlutterActivityLaunchConfigs.BackgroundMode.transparentwill configure the innerFlutterViewof thisFlutterActivityto be configured with aFlutterTextureViewto support transparency. This choice has a non-trivial performance impact. A transparent background should only be used if it is necessary for the app design being implemented.A
FlutterActivitythat is configured with a background mode ofFlutterActivityLaunchConfigs.BackgroundMode.transparentmust have a theme applied to it that includes the following property:<item name="android:windowIsTranslucent">true</item>.- Parameters:
backgroundMode- The background mode- Returns:
- The builder.
-
-