Class FlutterActivityDelegate
- java.lang.Object
-
- io.flutter.app.FlutterActivityDelegate
-
- All Implemented Interfaces:
ComponentCallbacks
,ComponentCallbacks2
,FlutterActivityEvents
,PluginRegistry
,PluginRegistry.ActivityResultListener
,PluginRegistry.RequestPermissionsResultListener
,FlutterView.Provider
@Deprecated public final class FlutterActivityDelegate extends Object implements FlutterActivityEvents, FlutterView.Provider, PluginRegistry
Deprecated.FlutterActivity
is the new API that now replaces this class andFlutterActivity
. See https://flutter.dev/go/android-project-migration for more migration details.Deprecated class that performs the actual work of tying AndroidActivity
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 subclassFlutterActivity
. The most obvious example of when this may come in handy is if an application wishes to subclass the Android v4 support library'sFragmentActivity
.Usage:
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 implementPluginRegistry
and/orFlutterView.Provider
and forward those methods to this class as well.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FlutterActivityDelegate.ViewFactory
Deprecated.Specifies the mechanism by which Flutter views are created during the operation of aFlutterActivityDelegate
.-
Nested classes/interfaces inherited from interface io.flutter.plugin.common.PluginRegistry
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListener
-
-
Field Summary
-
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_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 Summary
Constructors Constructor Description FlutterActivityDelegate(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FlutterView
getFlutterView()
Deprecated.Returns a reference to the Flutter view maintained by this object.boolean
hasPlugin(String key)
Deprecated.Returns whether the specified plugin is known to this registry.boolean
onActivityResult(int requestCode, int resultCode, Intent data)
Deprecated.boolean
onBackPressed()
Deprecated.Invoked when the activity has detected the user's press of the back key.void
onConfigurationChanged(Configuration newConfig)
Deprecated.void
onCreate(Bundle savedInstanceState)
Deprecated.void
onDestroy()
Deprecated.void
onLowMemory()
Deprecated.void
onNewIntent(Intent intent)
Deprecated.void
onPause()
Deprecated.void
onPostResume()
Deprecated.boolean
onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Deprecated.void
onResume()
Deprecated.void
onStart()
Deprecated.void
onStop()
Deprecated.void
onTrimMemory(int level)
Deprecated.void
onUserLeaveHint()
Deprecated.PluginRegistry.Registrar
registrarFor(String pluginKey)
Deprecated.Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.<T> T
valuePublishedByPlugin(String pluginKey)
Deprecated.Returns the value published by the specified plugin, if any.
-
-
-
Constructor Detail
-
FlutterActivityDelegate
public FlutterActivityDelegate(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory)
Deprecated.
-
-
Method Detail
-
getFlutterView
public FlutterView getFlutterView()
Deprecated.Description copied from interface:FlutterView.Provider
Returns a reference to the Flutter view maintained by this object. This may benull
.- Specified by:
getFlutterView
in interfaceFlutterView.Provider
- Returns:
- a reference to the Flutter view maintained by this object.
-
hasPlugin
public boolean hasPlugin(String key)
Deprecated.Description copied from interface:PluginRegistry
Returns whether the specified plugin is known to this registry.- Specified by:
hasPlugin
in interfacePluginRegistry
- Parameters:
key
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- true if this registry has handed out a registrar for the specified plugin.
-
valuePublishedByPlugin
public <T> T valuePublishedByPlugin(String pluginKey)
Deprecated.Description copied from interface:PluginRegistry
Returns the value published by the specified plugin, if any.Plugins 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.
- Specified by:
valuePublishedByPlugin
in interfacePluginRegistry
- Type Parameters:
T
- The type of the value.- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- the published value, possibly null.
-
registrarFor
public PluginRegistry.Registrar registrarFor(String pluginKey)
Deprecated.Description copied from interface:PluginRegistry
Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.- Specified by:
registrarFor
in interfacePluginRegistry
- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- A
PluginRegistry.Registrar
for receiving the registrations pertianing to the specified plugin.
-
onRequestPermissionsResult
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Deprecated.- Specified by:
onRequestPermissionsResult
in interfacePluginRegistry.RequestPermissionsResultListener
- Parameters:
requestCode
- The request code passed inActivityCompat.requestPermissions(android.app.Activity, String[], int)
.permissions
- The requested permissions.grantResults
- The grant results for the corresponding permissions which is eitherPackageManager.PERMISSION_GRANTED
orPackageManager.PERMISSION_DENIED
.- Returns:
- true if the result has been handled.
-
onActivityResult
public boolean onActivityResult(int requestCode, int resultCode, Intent data)
Deprecated.- Specified by:
onActivityResult
in interfacePluginRegistry.ActivityResultListener
- Parameters:
requestCode
- The integer request code originally supplied tostartActivityForResult()
, allowing you to identify who this result came from.resultCode
- The integer result code returned by the child activity through itssetResult()
.data
- An Intent, which can return result data to the caller (various data can be attached to Intent "extras").- Returns:
- true if the result has been handled.
-
onCreate
public void onCreate(Bundle savedInstanceState)
Deprecated.- Specified by:
onCreate
in interfaceFlutterActivityEvents
- Parameters:
savedInstanceState
- If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied inonSaveInstanceState(Bundle)
.- See Also:
Activity.onCreate(android.os.Bundle)
-
onNewIntent
public void onNewIntent(Intent intent)
Deprecated.- Specified by:
onNewIntent
in interfaceFlutterActivityEvents
- Parameters:
intent
- The new intent that was started for the activity.- See Also:
Activity.onNewIntent(Intent)
-
onPause
public void onPause()
Deprecated.- Specified by:
onPause
in interfaceFlutterActivityEvents
- See Also:
Activity.onPause()
-
onStart
public void onStart()
Deprecated.- Specified by:
onStart
in interfaceFlutterActivityEvents
- See Also:
Activity.onStart()
-
onResume
public void onResume()
Deprecated.- Specified by:
onResume
in interfaceFlutterActivityEvents
- See Also:
Activity.onResume()
-
onStop
public void onStop()
Deprecated.- Specified by:
onStop
in interfaceFlutterActivityEvents
- See Also:
Activity.onStop()
-
onPostResume
public void onPostResume()
Deprecated.- Specified by:
onPostResume
in interfaceFlutterActivityEvents
- See Also:
Activity.onPostResume()
-
onDestroy
public void onDestroy()
Deprecated.- Specified by:
onDestroy
in interfaceFlutterActivityEvents
- See Also:
Activity.onDestroy()
-
onBackPressed
public boolean onBackPressed()
Deprecated.Description copied from interface:FlutterActivityEvents
Invoked when the activity has detected the user's press of the back key.- Specified by:
onBackPressed
in interfaceFlutterActivityEvents
- Returns:
true
if the listener handled the event;false
to let the activity continue with its default back button handling.- See Also:
Activity.onBackPressed()
-
onUserLeaveHint
public void onUserLeaveHint()
Deprecated.- Specified by:
onUserLeaveHint
in interfaceFlutterActivityEvents
- See Also:
Activity.onUserLeaveHint()
-
onTrimMemory
public void onTrimMemory(int level)
Deprecated.- Specified by:
onTrimMemory
in interfaceComponentCallbacks2
-
onLowMemory
public void onLowMemory()
Deprecated.- Specified by:
onLowMemory
in interfaceComponentCallbacks
-
onConfigurationChanged
public void onConfigurationChanged(Configuration newConfig)
Deprecated.- Specified by:
onConfigurationChanged
in interfaceComponentCallbacks
-
-