Skip to content

Commit

Permalink
fix(fragmentation_core): make sure childFragment.onSupportVisible cal…
Browse files Browse the repository at this point in the history
…led when fragment resume , if parentFragment is shown when parent fragment is not resumed.

#1173 (comment)
  • Loading branch information
liaolintao committed Sep 25, 2019
1 parent 8af190f commit d5e79a3
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void onPause() {
public void onHiddenChanged(boolean hidden) {
if (!hidden && !mFragment.isResumed()) {
//if fragment is shown but not resumed, ignore...
mInvisibleWhenLeave = false;
onFragmentShownWhenNotResumed();
return;
}
if (hidden) {
Expand All @@ -119,6 +119,23 @@ public void onHiddenChanged(boolean hidden) {
}
}

private void onFragmentShownWhenNotResumed() {
mInvisibleWhenLeave = false;
dispatchChildOnFragmentShownWhenNotResumed();
}

private void dispatchChildOnFragmentShownWhenNotResumed() {
FragmentManager fragmentManager = mFragment.getChildFragmentManager();
List<Fragment> childFragments = FragmentationMagician.getActiveFragments(fragmentManager);
if (childFragments != null) {
for (Fragment child : childFragments) {
if (child instanceof ISupportFragment && !child.isHidden() && child.getUserVisibleHint()) {
((ISupportFragment) child).getSupportDelegate().getVisibleDelegate().onFragmentShownWhenNotResumed();
}
}
}
}

public void onDestroyView() {
mIsFirstVisible = true;
}
Expand Down

0 comments on commit d5e79a3

Please sign in to comment.