Commit 43926214 authored by Firewayer's avatar Firewayer

fix多tab情况下,Fragment切换时生命周期未正确同步至Boost的Bug

parent a62aa224
...@@ -259,13 +259,17 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm ...@@ -259,13 +259,17 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
delegate.onStart(); if (!isHidden()) {
delegate.onStart();
}
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
delegate.onResume(); if (!isHidden()) {
delegate.onResume();
}
} }
// TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible.
...@@ -277,13 +281,17 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm ...@@ -277,13 +281,17 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
delegate.onPause(); if (!isHidden()) {
delegate.onPause();
}
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
delegate.onStop(); if (!isHidden()) {
delegate.onStop();
}
} }
@Override @Override
...@@ -300,6 +308,15 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm ...@@ -300,6 +308,15 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
delegate = null; delegate = null;
} }
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
delegate.onPause();
} else {
delegate.onResume();
}
}
@ActivityCallThrough @ActivityCallThrough
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment