public static class FlutterFragmentActivity.CachedEngineIntentBuilder extends Object
Intent
that launches a FlutterFragmentActivity
with an
existing FlutterEngine
that is cached in FlutterEngineCache
.Constructor and Description |
---|
CachedEngineIntentBuilder(Class<? extends FlutterFragmentActivity> activityClass,
String engineId)
Constructor that allows this
CachedEngineIntentBuilder to be used by subclasses of
FlutterFragmentActivity . |
Modifier and Type | Method and Description |
---|---|
FlutterFragmentActivity.CachedEngineIntentBuilder |
backgroundMode(FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)
The mode of
FlutterFragmentActivity 's background, either FlutterActivityLaunchConfigs.BackgroundMode.opaque or FlutterActivityLaunchConfigs.BackgroundMode.transparent . |
Intent |
build(Context context)
Creates and returns an
Intent that will launch a FlutterFragmentActivity with
the desired configuration. |
FlutterFragmentActivity.CachedEngineIntentBuilder |
destroyEngineWithActivity(boolean destroyEngineWithActivity)
Returns true if the cached
FlutterEngine should be destroyed and removed from the
cache when this FlutterFragmentActivity is destroyed. |
public CachedEngineIntentBuilder(@NonNull Class<? extends FlutterFragmentActivity> activityClass, @NonNull String engineId)
CachedEngineIntentBuilder
to be used by subclasses of
FlutterFragmentActivity
.
Subclasses of FlutterFragmentActivity
should provide their own static version of
#withCachedEngine()
, which returns an instance of CachedEngineIntentBuilder
constructed with a Class
reference to the FlutterFragmentActivity
subclass,
e.g.:
return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId);
public FlutterFragmentActivity.CachedEngineIntentBuilder destroyEngineWithActivity(boolean destroyEngineWithActivity)
FlutterEngine
should be destroyed and removed from the
cache when this FlutterFragmentActivity
is destroyed.
The default value is false
.
@NonNull public FlutterFragmentActivity.CachedEngineIntentBuilder backgroundMode(@NonNull FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)
FlutterFragmentActivity
's background, either FlutterActivityLaunchConfigs.BackgroundMode.opaque
or FlutterActivityLaunchConfigs.BackgroundMode.transparent
.
The default background mode is FlutterActivityLaunchConfigs.BackgroundMode.opaque
.
Choosing a background mode of FlutterActivityLaunchConfigs.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 FlutterActivityLaunchConfigs.BackgroundMode.transparent
must have a theme applied to it that includes the following
property: <item name="android:windowIsTranslucent">true</item>
.