Interface ActivityControlSurface
-
public interface ActivityControlSurface
Control surface through which anActivity
attaches to aFlutterEngine
.An
Activity
that contains aFlutterView
and associatedFlutterEngine
should coordinate itself with theFlutterEngine
'sActivityControlSurface
.- Once an
Activity
is created, and its associatedFlutterEngine
is executing Dart code, theActivity
should invokeattachToActivity( ExclusiveAppComponent, Lifecycle)
. At this point theFlutterEngine
is considered "attached" to theActivity
and allActivityAware
plugins are given access to theActivity
. - Just before an attached
Activity
is destroyed for configuration change purposes, thatActivity
should invokedetachFromActivityForConfigChanges()
, giving eachActivityAware
plugin an opportunity to clean up its references before theis destroyed
. - When an
Activity
is destroyed for non-configuration-change purposes, or when theActivity
is no longer interested in displaying aFlutterEngine
's content, theActivity
should invokedetachFromActivity()
. - When a
Activity
is being attached while an existingExclusiveAppComponent
is already attached, the existingExclusiveAppComponent
is given a chance to detach first viaExclusiveAppComponent.detachFromFlutterEngine()
before the new activity attaches.
Activity
should also forward allActivity
calls that thisActivityControlSurface
supports, e.g.,onRequestPermissionsResult(int, String[], int[])
. These forwarded calls are made available to allActivityAware
plugins that are added to the attachedFlutterEngine
. - Once an
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
attachToActivity(ExclusiveAppComponent<Activity> exclusiveActivity, androidx.lifecycle.Lifecycle lifecycle)
Call this method from theExclusiveAppComponent
that is displaying the visual content of theFlutterEngine
that is associated with thisActivityControlSurface
.void
detachFromActivity()
Call this method from theActivity
that is attached to thisActivityControlSurfaces
'sFlutterEngine
when theActivity
is about to be destroyed for non-configuration-change reasons.void
detachFromActivityForConfigChanges()
Call this method from theActivity
that is attached to thisActivityControlSurfaces
'sFlutterEngine
when theActivity
is about to be destroyed due to configuration changes.boolean
onActivityResult(int requestCode, int resultCode, Intent data)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.void
onNewIntent(Intent intent)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.boolean
onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResult)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.void
onRestoreInstanceState(Bundle bundle)
Call this method from theActivity
orFragment
that is attached to thisActivityControlSurface
'sFlutterEngine
whenActivity.onCreate(Bundle)
orFragment#onCreate(Bundle)
is invoked in theActivity
orFragment
.void
onSaveInstanceState(Bundle bundle)
Call this method from theActivity
orFragment
that is attached to thisActivityControlSurface
'sFlutterEngine
when the associated method is invoked in theActivity
orFragment
.void
onUserLeaveHint()
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.
-
-
-
Method Detail
-
attachToActivity
void attachToActivity(@NonNull ExclusiveAppComponent<Activity> exclusiveActivity, @NonNull androidx.lifecycle.Lifecycle lifecycle)
Call this method from theExclusiveAppComponent
that is displaying the visual content of theFlutterEngine
that is associated with thisActivityControlSurface
.Once an
ExclusiveAppComponent
is created, and its associatedFlutterEngine
is executing Dart code, theExclusiveAppComponent
should invoke this method. At that point theFlutterEngine
is considered "attached" to theExclusiveAppComponent
and allActivityAware
plugins are given access to theExclusiveAppComponent
'sActivity
.
-
detachFromActivityForConfigChanges
void detachFromActivityForConfigChanges()
Call this method from theActivity
that is attached to thisActivityControlSurfaces
'sFlutterEngine
when theActivity
is about to be destroyed due to configuration changes.This method gives each
ActivityAware
plugin an opportunity to clean up its references before theis destroyed
.
-
detachFromActivity
void detachFromActivity()
Call this method from theActivity
that is attached to thisActivityControlSurfaces
'sFlutterEngine
when theActivity
is about to be destroyed for non-configuration-change reasons.This method gives each
ActivityAware
plugin an opportunity to clean up its references before theis destroyed
.
-
onRequestPermissionsResult
boolean onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResult)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.Returns true if one or more plugins utilized this permission result.
-
onActivityResult
boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.Returns true if one or more plugins utilized this
Activity
result.
-
onNewIntent
void onNewIntent(@NonNull Intent intent)
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.
-
onUserLeaveHint
void onUserLeaveHint()
Call this method from theActivity
that is attached to thisActivityControlSurface
'sFlutterEngine
and the associated method in theActivity
is invoked.
-
onSaveInstanceState
void onSaveInstanceState(@NonNull Bundle bundle)
Call this method from theActivity
orFragment
that is attached to thisActivityControlSurface
'sFlutterEngine
when the associated method is invoked in theActivity
orFragment
.
-
onRestoreInstanceState
void onRestoreInstanceState(@Nullable Bundle bundle)
Call this method from theActivity
orFragment
that is attached to thisActivityControlSurface
'sFlutterEngine
whenActivity.onCreate(Bundle)
orFragment#onCreate(Bundle)
is invoked in theActivity
orFragment
.
-
-