Interface ActivityControlSurface
-
public interface ActivityControlSurfaceControl surface through which anActivityattaches to aFlutterEngine.An
Activitythat contains aFlutterViewand associatedFlutterEngineshould coordinate itself with theFlutterEngine'sActivityControlSurface.- Once an
Activityis created, and its associatedFlutterEngineis executing Dart code, theActivityshould invokeattachToActivity( ExclusiveAppComponent, Lifecycle). At this point theFlutterEngineis considered "attached" to theActivityand allActivityAwareplugins are given access to theActivity. - Just before an attached
Activityis destroyed for configuration change purposes, thatActivityshould invokedetachFromActivityForConfigChanges(), giving eachActivityAwareplugin an opportunity to clean up its references before theis destroyed. - When an
Activityis destroyed for non-configuration-change purposes, or when theActivityis no longer interested in displaying aFlutterEngine's content, theActivityshould invokedetachFromActivity(). - When a
Activityis being attached while an existingExclusiveAppComponentis already attached, the existingExclusiveAppComponentis given a chance to detach first viaExclusiveAppComponent.detachFromFlutterEngine()before the new activity attaches.
Activityshould also forward allActivitycalls that thisActivityControlSurfacesupports, e.g.,onRequestPermissionsResult(int, String[], int[]). These forwarded calls are made available to allActivityAwareplugins that are added to the attachedFlutterEngine. - Once an
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattachToActivity(ExclusiveAppComponent<Activity> exclusiveActivity, androidx.lifecycle.Lifecycle lifecycle)Call this method from theExclusiveAppComponentthat is displaying the visual content of theFlutterEnginethat is associated with thisActivityControlSurface.voiddetachFromActivity()Call this method from theActivitythat is attached to thisActivityControlSurfaces'sFlutterEnginewhen theActivityis about to be destroyed for non-configuration-change reasons.voiddetachFromActivityForConfigChanges()Call this method from theActivitythat is attached to thisActivityControlSurfaces'sFlutterEnginewhen theActivityis about to be destroyed due to configuration changes.booleanonActivityResult(int requestCode, int resultCode, Intent data)Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.voidonNewIntent(Intent intent)Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.booleanonRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResult)Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.voidonRestoreInstanceState(Bundle bundle)Call this method from theActivityorFragmentthat is attached to thisActivityControlSurface'sFlutterEnginewhenActivity.onCreate(Bundle)orFragment#onCreate(Bundle)is invoked in theActivityorFragment.voidonSaveInstanceState(Bundle bundle)Call this method from theActivityorFragmentthat is attached to thisActivityControlSurface'sFlutterEnginewhen the associated method is invoked in theActivityorFragment.voidonUserLeaveHint()Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.
-
-
-
Method Detail
-
attachToActivity
void attachToActivity(@NonNull ExclusiveAppComponent<Activity> exclusiveActivity, @NonNull androidx.lifecycle.Lifecycle lifecycle)Call this method from theExclusiveAppComponentthat is displaying the visual content of theFlutterEnginethat is associated with thisActivityControlSurface.Once an
ExclusiveAppComponentis created, and its associatedFlutterEngineis executing Dart code, theExclusiveAppComponentshould invoke this method. At that point theFlutterEngineis considered "attached" to theExclusiveAppComponentand allActivityAwareplugins are given access to theExclusiveAppComponent'sActivity.
-
detachFromActivityForConfigChanges
void detachFromActivityForConfigChanges()
Call this method from theActivitythat is attached to thisActivityControlSurfaces'sFlutterEnginewhen theActivityis about to be destroyed due to configuration changes.This method gives each
ActivityAwareplugin an opportunity to clean up its references before theis destroyed.
-
detachFromActivity
void detachFromActivity()
Call this method from theActivitythat is attached to thisActivityControlSurfaces'sFlutterEnginewhen theActivityis about to be destroyed for non-configuration-change reasons.This method gives each
ActivityAwareplugin 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 theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis 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 theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.Returns true if one or more plugins utilized this
Activityresult.
-
onNewIntent
void onNewIntent(@NonNull Intent intent)Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.
-
onUserLeaveHint
void onUserLeaveHint()
Call this method from theActivitythat is attached to thisActivityControlSurface'sFlutterEngineand the associated method in theActivityis invoked.
-
onSaveInstanceState
void onSaveInstanceState(@NonNull Bundle bundle)Call this method from theActivityorFragmentthat is attached to thisActivityControlSurface'sFlutterEnginewhen the associated method is invoked in theActivityorFragment.
-
onRestoreInstanceState
void onRestoreInstanceState(@Nullable Bundle bundle)Call this method from theActivityorFragmentthat is attached to thisActivityControlSurface'sFlutterEnginewhenActivity.onCreate(Bundle)orFragment#onCreate(Bundle)is invoked in theActivityorFragment.
-
-