mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Updated the code to allow fragments in ViewPager to start as soon as they are visible
This commit is contained in:
parent
97156d6061
commit
cb054007da
2 changed files with 10 additions and 12 deletions
|
@ -65,12 +65,11 @@ public class LiveFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPrimaryItem(ViewGroup container, int position, Object object) {
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
super.setPrimaryItem(container, position, object);
|
// Allow the non-primary fragments to start as soon as they are visible
|
||||||
// Hack to allow the non-primary fragments to start properly
|
Fragment f = (Fragment) super.instantiateItem(container, position);
|
||||||
if (object != null) {
|
f.setUserVisibleHint(true);
|
||||||
((Fragment) object).setUserVisibleHint(false);
|
return f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,12 +186,11 @@ public class TracksFragment extends Fragment implements LoaderCallbacks<List<Day
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPrimaryItem(ViewGroup container, int position, Object object) {
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
super.setPrimaryItem(container, position, object);
|
// Allow the non-primary fragments to start as soon as they are visible
|
||||||
// Hack to allow the non-primary fragments to start properly
|
Fragment f = (Fragment) super.instantiateItem(container, position);
|
||||||
if (object != null) {
|
f.setUserVisibleHint(true);
|
||||||
((Fragment) object).setUserVisibleHint(false);
|
return f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue