Search in sources :

Example 1 with GlideImageLoader

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());
}
Also used : ArrayList(java.util.ArrayList) BaseFragmentPagerAdapter(com.itculturalfestival.smartcampus.adapter.BaseFragmentPagerAdapter) GlideImageLoader(com.itculturalfestival.smartcampus.utils.GlideImageLoader) AppBaseFragment(com.itculturalfestival.smartcampus.AppBaseFragment) Fragment(android.support.v4.app.Fragment)

Aggregations

Fragment (android.support.v4.app.Fragment)1 AppBaseFragment (com.itculturalfestival.smartcampus.AppBaseFragment)1 BaseFragmentPagerAdapter (com.itculturalfestival.smartcampus.adapter.BaseFragmentPagerAdapter)1 GlideImageLoader (com.itculturalfestival.smartcampus.utils.GlideImageLoader)1 ArrayList (java.util.ArrayList)1