Search in sources :

Example 1 with GridItemDecoration

use of com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration in project SmartCampus by Vegen.

the class NewsFragment method setupUI.

@Override
protected void setupUI() {
    Bundle bundle = getArguments();
    newsType = bundle.getInt("newsType", Constant.NEWS_TYPE_FLASH);
    showContentView();
    homeNewsAdapter = new HomeNewsAdapter();
    homeNewsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    GridLayoutManager layoutManage = new FullyGridLayoutManager(getContext(), 2);
    recyclerView.setLayoutManager(layoutManage);
    recyclerView.setAdapter(homeNewsAdapter);
    recyclerView.addItemDecoration(new GridItemDecoration());
    View emptyView = View.inflate(getContext(), R.layout.app_view_empty, null);
    homeNewsAdapter.setEmptyView(emptyView);
    View footerView = LayoutInflater.from(getActivity()).inflate(R.layout.app_footer_home_news, (ViewGroup) root, false);
    homeNewsAdapter.setFooterView(footerView);
    tvFooter = footerView.findViewById(R.id.tv_footer);
    if (tvFooter != null) {
        tvFooter.setOnClickListener(v -> {
            MoreNewsActivity.start(getContext(), newsType, nextUrl);
        });
    }
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) FullyGridLayoutManager(com.itculturalfestival.smartcampus.utils.FullyGridLayoutManager) Bundle(android.os.Bundle) HomeNewsAdapter(com.itculturalfestival.smartcampus.adapter.HomeNewsAdapter) FullyGridLayoutManager(com.itculturalfestival.smartcampus.utils.FullyGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) GridItemDecoration(com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration)

Example 2 with GridItemDecoration

use of com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration in project SmartCampus by Vegen.

the class LostAndFoundActivity method setupUI.

@Override
protected void setupUI() {
    setTitle("失物招领");
    lostAndFoundAdapter = new LostAndFoundAdapter();
    lostAndFoundAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    RecyclerView.LayoutManager layoutManage = /*new FullyGridLayoutManager(this, 2); // */
    new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManage);
    recyclerView.setAdapter(lostAndFoundAdapter);
    new QuickReturnTopManager(recyclerView);
    recyclerView.addItemDecoration(new GridItemDecoration());
    View emptyView = View.inflate(this, R.layout.app_view_empty, null);
    lostAndFoundAdapter.setEmptyView(emptyView);
    lostAndFoundAdapter.setOnLoadMoreListener(() -> {
        presenter().getLostList(SKIP, skip);
        LogUtils.e("更多更多!!!");
    }, recyclerView);
    lostAndFoundAdapter.disableLoadMoreIfNotFullPage();
    refreshLayout.setEnableLoadmore(false);
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(TwinklingRefreshLayout refreshLayout) {
            super.onRefresh(refreshLayout);
            loadData();
        }
    });
}
Also used : RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RecyclerView(android.support.v7.widget.RecyclerView) QuickReturnTopManager(com.itculturalfestival.smartcampus.utils.QuickReturnTopManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) LostAndFoundAdapter(com.itculturalfestival.smartcampus.adapter.LostAndFoundAdapter) GridItemDecoration(com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 GridItemDecoration (com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration)2 Bundle (android.os.Bundle)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 TextView (android.widget.TextView)1 HomeNewsAdapter (com.itculturalfestival.smartcampus.adapter.HomeNewsAdapter)1 LostAndFoundAdapter (com.itculturalfestival.smartcampus.adapter.LostAndFoundAdapter)1 FullyGridLayoutManager (com.itculturalfestival.smartcampus.utils.FullyGridLayoutManager)1 QuickReturnTopManager (com.itculturalfestival.smartcampus.utils.QuickReturnTopManager)1 RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)1 TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)1