use of com.itculturalfestival.smartcampus.utils.GlideImageLoader in project SmartCampus by Vegen.
the class HomeFragment method setupUI.
@Override
protected void setupUI() {
showContentView();
ImmersionBar.setTitleBar(getActivity(), toolbar);
float marginHeight = SystemUtils.getStatusBarHeight(getContext()) + SystemUtils.getActionBarHeight(getContext());
viewTop.getLayoutParams().height = (int) marginHeight;
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
banner.setIndicatorGravity(BannerConfig.CENTER);
banner.setImageLoader(new GlideImageLoader());
banner.setOnBannerListener(position -> {
if (bannerList.isEmpty())
return;
TopFunArticleDetailActivity.start(getContext(), bannerList.get(position).getTitle(), bannerList.get(position).getNextUrl());
});
List<Fragment> fragments = new ArrayList<>();
flashFragment = NewsFragment.getInstance(Constant.NEWS_TYPE_FLASH);
focusFragment = NewsFragment.getInstance(Constant.NEWS_TYPE_FOCUS);
comprehensiveFragment = NewsFragment.getInstance(Constant.NEWS_TYPE_COMPREHENSIVE);
otherFragment = NewsFragment.getInstance(Constant.NEWS_TYPE_OTHER);
fragments.add(flashFragment);
fragments.add(focusFragment);
fragments.add(comprehensiveFragment);
fragments.add(otherFragment);
List<String> strings = new ArrayList<>();
strings.add("快讯");
strings.add("要闻");
strings.add("综合");
strings.add("其他");
fragmentPagerAdapter = new BaseFragmentPagerAdapter(getChildFragmentManager(), fragments, strings);
viewPager.setAdapter(fragmentPagerAdapter);
tabLayout.setupWithViewPager(viewPager);
viewPager.setOffscreenPageLimit(fragments.size());
}
Aggregations