Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.embedding.android.FlutterFragmentActivity.CachedEngineIntentBuilder Class Reference

Public Member Functions

 CachedEngineIntentBuilder ( @NonNull Class<? extends FlutterFragmentActivity > activityClass, @NonNull String engineId)
 
CachedEngineIntentBuilder destroyEngineWithActivity (boolean destroyEngineWithActivity)
 
CachedEngineIntentBuilder backgroundMode (@NonNull BackgroundMode backgroundMode)
 
Intent build (@NonNull Context context)
 

Detailed Description

Builder to create an Intent that launches a FlutterFragmentActivity with an existing io.flutter.embedding.engine.FlutterEngine that is cached in io.flutter.embedding.engine.FlutterEngineCache.

Definition at line 195 of file FlutterFragmentActivity.java.

Constructor & Destructor Documentation

◆ CachedEngineIntentBuilder()

io.flutter.embedding.android.FlutterFragmentActivity.CachedEngineIntentBuilder.CachedEngineIntentBuilder ( @NonNull Class<? extends FlutterFragmentActivity activityClass,
@NonNull String  engineId 
)
inline

Constructor that allows this CachedEngineIntentBuilder to be used by subclasses of FlutterFragmentActivity.

Subclasses of FlutterFragmentActivity should provide their own static version of withCachedEngine(String), which returns an instance of
CachedEngineIntentBuilder
constructed with a Class reference to the
FlutterFragmentActivity
subclass, e.g.:

return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId);

Definition at line 212 of file FlutterFragmentActivity.java.

213 {
214 this.activityClass = activityClass;
215 this.cachedEngineId = engineId;
216 }

Member Function Documentation

◆ backgroundMode()

CachedEngineIntentBuilder io.flutter.embedding.android.FlutterFragmentActivity.CachedEngineIntentBuilder.backgroundMode ( @NonNull BackgroundMode  backgroundMode)
inline

The mode of FlutterFragmentActivity's background, either BackgroundMode#opaque or BackgroundMode#transparent.

The default background mode is BackgroundMode#opaque.

Choosing a background mode of BackgroundMode#transparent will configure the inner FlutterView of this FlutterFragmentActivity to be configured with a FlutterTextureView to 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 FlutterFragmentActivity that is configured with a background mode of BackgroundMode#transparent must have a theme applied to it that includes the following property: <item name="android:windowIsTranslucent">true</item>.

Definition at line 246 of file FlutterFragmentActivity.java.

246 {
247 this.backgroundMode = backgroundMode.name();
248 return this;
249 }

◆ build()

Intent io.flutter.embedding.android.FlutterFragmentActivity.CachedEngineIntentBuilder.build ( @NonNull Context  context)
inline

Creates and returns an Intent that will launch a FlutterFragmentActivity with the desired configuration.

Definition at line 256 of file FlutterFragmentActivity.java.

256 {
257 return new Intent(context, activityClass)
258 .putExtra(EXTRA_CACHED_ENGINE_ID, cachedEngineId)
259 .putExtra(EXTRA_DESTROY_ENGINE_WITH_ACTIVITY, destroyEngineWithActivity)
260 .putExtra(EXTRA_BACKGROUND_MODE, backgroundMode);
261 }

◆ destroyEngineWithActivity()

CachedEngineIntentBuilder io.flutter.embedding.android.FlutterFragmentActivity.CachedEngineIntentBuilder.destroyEngineWithActivity ( boolean  destroyEngineWithActivity)
inline

Returns true if the cached io.flutter.embedding.engine.FlutterEngine should be destroyed and removed from the cache when this FlutterFragmentActivity is destroyed.

The default value is false.

Definition at line 224 of file FlutterFragmentActivity.java.

224 {
225 this.destroyEngineWithActivity = destroyEngineWithActivity;
226 return this;
227 }

The documentation for this class was generated from the following file: