Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.embedding.android.FlutterActivity.CachedEngineIntentBuilder Class Reference

Public Member Functions

 CachedEngineIntentBuilder ( @NonNull Class<? extends FlutterActivity > 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 FlutterActivity with an existing io.flutter.embedding.engine.FlutterEngine that is cached in io.flutter.embedding.engine.FlutterEngineCache.

Definition at line 370 of file FlutterActivity.java.

Constructor & Destructor Documentation

◆ CachedEngineIntentBuilder()

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

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

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

return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId);

Parameters
activityClassA subclass of FlutterActivity.
engineIdThe engine id.

Definition at line 390 of file FlutterActivity.java.

391 {
392 this.activityClass = activityClass;
393 this.cachedEngineId = engineId;
394 }

Member Function Documentation

◆ backgroundMode()

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

The mode of FlutterActivity'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 FlutterActivity 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 FlutterActivity 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>.

Parameters
backgroundModeThe background mode
Returns
The builder.

Definition at line 430 of file FlutterActivity.java.

430 {
431 this.backgroundMode = backgroundMode.name();
432 return this;
433 }

◆ build()

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

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

Parameters
contextThe context. e.g. An Activity.
Returns
The intent.

Definition at line 443 of file FlutterActivity.java.

443 {
444 return new Intent(context, activityClass)
445 .putExtra(EXTRA_CACHED_ENGINE_ID, cachedEngineId)
446 .putExtra(EXTRA_DESTROY_ENGINE_WITH_ACTIVITY, destroyEngineWithActivity)
447 .putExtra(EXTRA_BACKGROUND_MODE, backgroundMode);
448 }

◆ destroyEngineWithActivity()

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

Whether the cached io.flutter.embedding.engine.FlutterEngine should be destroyed and removed from the cache when this FlutterActivity is destroyed.

The default value is false.

Parameters
destroyEngineWithActivityWhether to destroy the engine.
Returns
The builder.

Definition at line 405 of file FlutterActivity.java.

405 {
406 this.destroyEngineWithActivity = destroyEngineWithActivity;
407 return this;
408 }

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