Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Set the user-visible hint on fragments in FragmentStatePagerAd…
Browse files Browse the repository at this point in the history
…apter"
  • Loading branch information
Jean-Baptiste Queru authored and android code review committed Aug 8, 2012
2 parents 51f642b + 6d6186b commit bf7974e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public Object instantiateItem(ViewGroup container, int position) {
mFragments.add(null);
}
FragmentCompat.setMenuVisibility(fragment, false);
FragmentCompat.setUserVisibleHint(fragment, false);
mFragments.set(position, fragment);
mCurTransaction.add(container.getId(), fragment);

Expand Down Expand Up @@ -148,9 +149,11 @@ public void setPrimaryItem(ViewGroup container, int position, Object object) {
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
FragmentCompat.setMenuVisibility(mCurrentPrimaryItem, false);
FragmentCompat.setUserVisibleHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
FragmentCompat.setMenuVisibility(fragment, true);
FragmentCompat.setUserVisibleHint(fragment, true);
}
mCurrentPrimaryItem = fragment;
}
Expand Down
3 changes: 3 additions & 0 deletions v4/java/android/support/v4/app/FragmentStatePagerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public Object instantiateItem(ViewGroup container, int position) {
mFragments.add(null);
}
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
mFragments.set(position, fragment);
mCurTransaction.add(container.getId(), fragment);

Expand Down Expand Up @@ -144,9 +145,11 @@ public void setPrimaryItem(ViewGroup container, int position, Object object) {
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
mCurrentPrimaryItem.setMenuVisibility(false);
mCurrentPrimaryItem.setUserVisibleHint(false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
}
mCurrentPrimaryItem = fragment;
}
Expand Down

0 comments on commit bf7974e

Please sign in to comment.