Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remembering scrolling position #238

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ public static MyMusicFragment newInstance(final DEFAULTTAB defaulttab) {

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_my_music, container, false);
View view = inflater.inflate(R.layout.fragment_my_music, container, false);

// inflating this here is not a good idea AFAIK
mMyMusicViewPager = view.findViewById(R.id.my_music_viewpager);
mMyMusicViewPager.setOffscreenPageLimit(2);

return view;
}

@Override
Expand All @@ -135,7 +141,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
mMyMusicViewPager = view.findViewById(R.id.my_music_viewpager);
mMyMusicPagerAdapter = new MyMusicPagerAdapter(getChildFragmentManager());
mMyMusicViewPager.setAdapter(mMyMusicPagerAdapter);
mMyMusicViewPager.setOffscreenPageLimit(2);
tabLayout.setupWithViewPager(mMyMusicViewPager, false);
tabLayout.addOnTabSelectedListener(this);

Expand Down