Search in sources :

Example 1 with MoreNewsAdapter

use of com.itculturalfestival.smartcampus.adapter.MoreNewsAdapter in project SmartCampus by Vegen.

the class MoreNewsActivity method setupUI.

@Override
protected void setupUI() {
    newsType = getIntent().getIntExtra("newsType", Constant.NEWS_TYPE_FLASH);
    setTitle(setTitleText(newsType));
    nextUrl = getIntent().getStringExtra("nextUrl");
    if (nextUrl == null)
        nextUrl = "/PreviewPhoto.aspx?classid=";
    MORE_NEWS_URL = Url.ROOT_URL + nextUrl;
    refreshLayout.setEnableLoadmore(false);
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(TwinklingRefreshLayout refreshLayout) {
            super.onRefresh(refreshLayout);
            loadData();
        }
    });
    moreNewsAdapter = new MoreNewsAdapter();
    moreNewsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(moreNewsAdapter);
    new QuickReturnTopManager(recyclerView);
    recyclerView.addItemDecoration(new ListItemDecoration());
    View emptyView = View.inflate(this, R.layout.app_view_empty, null);
    moreNewsAdapter.setEmptyView(emptyView);
    newsList = new ArrayList<>();
    moreNewsAdapter.setNewData(newsList);
    moreNewsAdapter.setOnLoadMoreListener(() -> presenter().getNewsList(page, MORE_NEWS_URL, newsType, __VIEWSTATE, __VIEWSTATEGENERATOR, __EVENTVALIDATION), recyclerView);
}
Also used : ListItemDecoration(com.itculturalfestival.smartcampus.utils.ItemDecoration.ListItemDecoration) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) QuickReturnTopManager(com.itculturalfestival.smartcampus.utils.QuickReturnTopManager) MoreNewsAdapter(com.itculturalfestival.smartcampus.adapter.MoreNewsAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 MoreNewsAdapter (com.itculturalfestival.smartcampus.adapter.MoreNewsAdapter)1 ListItemDecoration (com.itculturalfestival.smartcampus.utils.ItemDecoration.ListItemDecoration)1 QuickReturnTopManager (com.itculturalfestival.smartcampus.utils.QuickReturnTopManager)1 RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)1 TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)1