public final class FlutterActivityDelegate extends Object implements FlutterActivityEvents, FlutterView.Provider, PluginRegistry
Activity
instances to Flutter.
This exists as a dedicated class (as opposed to being integrated directly
into FlutterActivity) to facilitate applications that don't wish
to subclass FlutterActivity. The most obvious example of when this
may come in handy is if an application wishes to subclass the Android v4
support library's FragmentActivity.
To wire this class up to your activity, simply forward the events defined
in FlutterActivityEvents from your activity to an instance of this
class. Optionally, you can make your activity implement
PluginRegistry and/or FlutterView.Provider
and forward those methods to this class as well.
| Modifier and Type | Class and Description |
|---|---|
static interface |
FlutterActivityDelegate.ViewFactory
Specifies the mechanism by which Flutter views are created during the
operation of a
FlutterActivityDelegate. |
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListenerTRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN| Constructor and Description |
|---|
FlutterActivityDelegate(Activity activity,
FlutterActivityDelegate.ViewFactory viewFactory) |
| Modifier and Type | Method and Description |
|---|---|
FlutterView |
getFlutterView()
Returns a reference to the Flutter view maintained by this object.
|
boolean |
hasPlugin(String key)
Returns whether the specified plugin is known to this registry.
|
boolean |
onActivityResult(int requestCode,
int resultCode,
Intent data) |
boolean |
onBackPressed()
Invoked when the activity has detected the user's press of the back key.
|
void |
onConfigurationChanged(Configuration newConfig) |
void |
onCreate(Bundle savedInstanceState) |
void |
onDestroy() |
void |
onLowMemory() |
void |
onNewIntent(Intent intent) |
void |
onPause() |
void |
onPostResume() |
boolean |
onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults) |
void |
onResume() |
void |
onStart() |
void |
onStop() |
void |
onTrimMemory(int level) |
void |
onUserLeaveHint() |
PluginRegistry.Registrar |
registrarFor(String pluginKey)
Returns a
PluginRegistry.Registrar for receiving the registrations pertaining
to the specified plugin. |
<T> T |
valuePublishedByPlugin(String pluginKey)
Returns the value published by the specified plugin, if any.
|
public FlutterActivityDelegate(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory)
public FlutterView getFlutterView()
FlutterView.Providernull.getFlutterView in interface FlutterView.Providerpublic boolean hasPlugin(String key)
PluginRegistryhasPlugin in interface PluginRegistrykey - a unique String identifying the plugin; typically the
fully qualified name of the plugin's main class.public <T> T valuePublishedByPlugin(String pluginKey)
PluginRegistryPlugins may publish a single value, such as an instance of the plugin's main class, for situations where external control or interaction is needed. Clients are expected to know the value's type.
valuePublishedByPlugin in interface PluginRegistrypluginKey - a unique String identifying the plugin; typically the
fully qualified name of the plugin's main class.public PluginRegistry.Registrar registrarFor(String pluginKey)
PluginRegistryPluginRegistry.Registrar for receiving the registrations pertaining
to the specified plugin.registrarFor in interface PluginRegistrypluginKey - a unique String identifying the plugin; typically the
fully qualified name of the plugin's main class.public boolean onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults)
onRequestPermissionsResult in interface PluginRegistry.RequestPermissionsResultListenerpublic boolean onActivityResult(int requestCode,
int resultCode,
Intent data)
onActivityResult in interface PluginRegistry.ActivityResultListenerpublic void onCreate(Bundle savedInstanceState)
onCreate in interface FlutterActivityEventsActivity.onCreate(android.os.Bundle)public void onNewIntent(Intent intent)
onNewIntent in interface FlutterActivityEventsActivity.onNewIntent(Intent)public void onPause()
onPause in interface FlutterActivityEventsActivity.onPause()public void onStart()
onStart in interface FlutterActivityEventsActivity.onStart()public void onResume()
onResume in interface FlutterActivityEventsActivity.onResume()public void onStop()
onStop in interface FlutterActivityEventsActivity.onStop()public void onPostResume()
onPostResume in interface FlutterActivityEventsActivity.onPostResume()public void onDestroy()
onDestroy in interface FlutterActivityEventsActivity.onDestroy()public boolean onBackPressed()
FlutterActivityEventsonBackPressed in interface FlutterActivityEventstrue if the listener handled the event; false
to let the activity continue with its default back button handling.Activity.onBackPressed()public void onUserLeaveHint()
onUserLeaveHint in interface FlutterActivityEventsActivity.onUserLeaveHint()public void onTrimMemory(int level)
onTrimMemory in interface ComponentCallbacks2public void onLowMemory()
onLowMemory in interface ComponentCallbackspublic void onConfigurationChanged(Configuration newConfig)
onConfigurationChanged in interface ComponentCallbacks