use of org.wikipedia.feed.FeedFragment in project apps-android-wikipedia by wikimedia.
the class MainFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_main, container, false);
unbinder = ButterKnife.bind(this, view);
viewPager.setAdapter(new NavTabFragmentPagerAdapter(getChildFragmentManager()));
tabLayout.setOnNavigationItemSelectedListener(item -> {
Fragment fragment = ((NavTabFragmentPagerAdapter) viewPager.getAdapter()).getCurrentFragment();
if (fragment instanceof FeedFragment && item.getOrder() == 0) {
((FeedFragment) fragment).scrollToTop();
}
viewPager.setCurrentItem(item.getOrder());
return true;
});
if (savedInstanceState == null) {
handleIntent(getActivity().getIntent());
}
return view;
}
use of org.wikipedia.feed.FeedFragment in project apps-android-wikipedia by wikimedia.
the class MainFragment method requestUpdateToolbarElevation.
public void requestUpdateToolbarElevation() {
Fragment fragment = ((NavTabFragmentPagerAdapter) viewPager.getAdapter()).getCurrentFragment();
updateToolbarElevation(!(fragment instanceof FeedFragment) || ((FeedFragment) fragment).shouldElevateToolbar());
}
Aggregations