mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
add onStart hook which places flutter in an inactive state (#5177)
This commit is contained in:
parent
13abe8772e
commit
e1cd506187
@ -81,6 +81,12 @@ public class FlutterActivity extends Activity implements FlutterView.Provider, P
|
||||
eventDelegate.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
eventDelegate.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@ -206,6 +206,13 @@ public final class FlutterActivityDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (flutterView != null) {
|
||||
flutterView.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
Application app = (Application) activity.getApplicationContext();
|
||||
|
||||
@ -39,6 +39,11 @@ public interface FlutterActivityEvents
|
||||
*/
|
||||
void onPause();
|
||||
|
||||
/**
|
||||
* @see android.app.Activity#onStart()
|
||||
*/
|
||||
void onStart();
|
||||
|
||||
/**
|
||||
* @see android.app.Activity#onResume()
|
||||
*/
|
||||
|
||||
@ -266,6 +266,10 @@ public class FlutterView extends SurfaceView
|
||||
mActivityLifecycleListeners.add(listener);
|
||||
}
|
||||
|
||||
public void onStart() {
|
||||
mFlutterLifecycleChannel.send("AppLifecycleState.inactive");
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
mFlutterLifecycleChannel.send("AppLifecycleState.inactive");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user