public interface ActivityControlSurface
Activity
attaches to a FlutterEngine
.
An Activity
that contains a FlutterView
and associated FlutterEngine
should coordinate itself with the FlutterEngine
's ActivityControlSurface
.
Activity
is created, and its associated FlutterEngine
is
executing Dart code, the Activity
should invoke
attachToActivity(Activity, Lifecycle)
. At this point the FlutterEngine
is considered "attached" to the Activity
and all ActivityAware
plugins
are given access to the Activity
.Activity
is destroyed for configuration change purposes,
that Activity
should invoke detachFromActivityForConfigChanges()
, giving
each ActivityAware
plugin an opportunity to clean up its references before the
is destroyed
.Activity
is recreated after configuration changes, that Activity
should invoke #reattachToActivityAfterConfigChange(Activity)
so that all
ActivityAware
plugins can re-establish references to the Activity
.Activity
is destroyed for non-configuration-change purposes, or when
the Activity
is no longer interested in displaying a FlutterEngine
's content,
the Activity
should invoke detachFromActivity()
.Activity
should also forward all Activity
calls that this
ActivityControlSurface
supports, e.g.,
onRequestPermissionsResult(int, String[], int[])
. These forwarded calls are made
available to all ActivityAware
plugins that are added to the attached FlutterEngine
.Modifier and Type | Method and Description |
---|---|
void |
attachToActivity(Activity activity,
android.arch.lifecycle.Lifecycle lifecycle)
Call this method from the
Activity that is displaying the visual content of the
FlutterEngine that is associated with this ActivityControlSurface . |
void |
detachFromActivity()
|
void |
detachFromActivityForConfigChanges()
|
boolean |
onActivityResult(int requestCode,
int resultCode,
Intent data)
|
void |
onNewIntent(Intent intent)
|
boolean |
onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResult)
|
void |
onRestoreInstanceState(Bundle bundle)
Call this method from the
Activity or Fragment that is attached to this
ActivityControlSurface 's FlutterEngine when Activity.onCreate(Bundle)
or Fragment#onActivityCreated(Bundle) is invoked in the Activity or
Fragment . |
void |
onSaveInstanceState(Bundle bundle)
|
void |
onUserLeaveHint()
|
void attachToActivity(@NonNull Activity activity, @NonNull android.arch.lifecycle.Lifecycle lifecycle)
Activity
that is displaying the visual content of the
FlutterEngine
that is associated with this ActivityControlSurface
.
Once an Activity
is created, and its associated FlutterEngine
is
executing Dart code, the Activity
should invoke this method. At that point the
FlutterEngine
is considered "attached" to the Activity
and all
ActivityAware
plugins are given access to the Activity
.
void detachFromActivityForConfigChanges()
Activity
that is attached to this ActivityControlSurfaces
's
FlutterEngine
when the Activity
is about to be destroyed due to configuration
changes.
This method gives each ActivityAware
plugin an opportunity to clean up its references
before the is destroyed
.
void detachFromActivity()
Activity
that is attached to this ActivityControlSurfaces
's
FlutterEngine
when the Activity
is about to be destroyed for non-configuration-change
reasons.
This method gives each ActivityAware
plugin an opportunity to clean up its references
before the is destroyed
.
boolean onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResult)
void onUserLeaveHint()
void onRestoreInstanceState(@Nullable Bundle bundle)
Activity
or Fragment
that is attached to this
ActivityControlSurface
's FlutterEngine
when Activity.onCreate(Bundle)
or Fragment#onActivityCreated(Bundle)
is invoked in the Activity
or
Fragment
.