Search in sources :

Example 6 with RefreshListenerAdapter

use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class NestedLayoutActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView rv) {
    rv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    photoAdapter = new PhotoAdapter();
    rv.setAdapter(photoAdapter);
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    //        ProgressLayout headerView = new ProgressLayout(this);
    BezierLayout headerView = new BezierLayout(this);
    refreshLayout.setHeaderView(headerView);
    refreshLayout.setMaxHeadHeight(140);
    //        refreshLayout.setFloatRefresh(true);
    //        refreshLayout.setPureScrollModeOn(true);
    refreshLayout.setOverScrollBottomShow(false);
    refreshLayout.setTargetView(rv);
    //        refreshLayout.setAutoLoadMore(true);
    //        addHeader();
    refreshCard();
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshCard();
                    refreshLayout.finishRefreshing();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
//        refreshLayout.startRefresh();
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) PhotoAdapter(com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter) Handler(android.os.Handler) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) BezierLayout(com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)

Example 7 with RefreshListenerAdapter

use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class PhotoActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView rv) {
    rv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    photoAdapter = new PhotoAdapter();
    rv.setAdapter(photoAdapter);
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    //        ProgressLayout headerView = new ProgressLayout(this);
    BezierLayout headerView = new BezierLayout(this);
    refreshLayout.setHeaderView(headerView);
    refreshLayout.setMaxHeadHeight(140);
    //        refreshLayout.setFloatRefresh(true);
    //        refreshLayout.setPureScrollModeOn(true);
    refreshLayout.setOverScrollBottomShow(false);
    //        refreshLayout.setAutoLoadMore(true);
    //        addHeader();
    refreshCard();
    findViewById(R.id.ib_refresh).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            refreshLayout.startRefresh();
        }
    });
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshCard();
                    refreshLayout.finishRefreshing();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
//        refreshLayout.startRefresh();
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) PhotoAdapter(com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter) Handler(android.os.Handler) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) BezierLayout(com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 8 with RefreshListenerAdapter

use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class CoordinateActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView rv) {
    rv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    photoAdapter = new PhotoAdapter();
    rv.setAdapter(photoAdapter);
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    ProgressLayout header = new ProgressLayout(this);
    refreshLayout.setHeaderView(header);
    refreshLayout.setFloatRefresh(true);
    refreshLayout.setEnableOverScroll(false);
    refreshLayout.setHeaderHeight(140);
    refreshLayout.setMaxHeadHeight(240);
    refreshLayout.setTargetView(rv);
    refreshCard();
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshCard();
                    refreshLayout.finishRefreshing();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) PhotoAdapter(com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter) Handler(android.os.Handler) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ProgressLayout(com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout)

Example 9 with RefreshListenerAdapter

use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project SmartCampus by Vegen.

the class EmploymentListActivity method setupUI.

@Override
protected void setupUI() {
    type = getIntent().getIntExtra("type", Constant.NOTICE);
    title = getIntent().getStringExtra("title");
    url = getIntent().getStringExtra("url");
    setTitle(title);
    refreshLayout.setEnableLoadmore(false);
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(TwinklingRefreshLayout refreshLayout) {
            super.onRefresh(refreshLayout);
            loadData();
        }
    });
    employmentListAdapter = new EmploymentListAdapter();
    employmentListAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(employmentListAdapter);
    new QuickReturnTopManager(recyclerView);
    recyclerView.addItemDecoration(new ListItemDecoration());
    View emptyView = View.inflate(this, R.layout.app_view_empty, null);
    employmentListAdapter.setEmptyView(emptyView);
    employmentListAdapter.setOnLoadMoreListener(() -> presenter().getEmploymentList(url + page, type), 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) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) EmploymentListAdapter(com.itculturalfestival.smartcampus.adapter.EmploymentListAdapter)

Example 10 with RefreshListenerAdapter

use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter 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

RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)10 TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)10 Handler (android.os.Handler)7 View (android.view.View)6 RecyclerView (android.support.v7.widget.RecyclerView)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)3 QuickReturnTopManager (com.itculturalfestival.smartcampus.utils.QuickReturnTopManager)3 ProgressLayout (com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout)3 PhotoAdapter (com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter)3 AdapterView (android.widget.AdapterView)2 ListItemDecoration (com.itculturalfestival.smartcampus.utils.ItemDecoration.ListItemDecoration)2 BezierLayout (com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)2 SuppressLint (android.annotation.SuppressLint)1 GridView (android.widget.GridView)1 ListView (android.widget.ListView)1 EmploymentListAdapter (com.itculturalfestival.smartcampus.adapter.EmploymentListAdapter)1 LostAndFoundAdapter (com.itculturalfestival.smartcampus.adapter.LostAndFoundAdapter)1 MoreNewsAdapter (com.itculturalfestival.smartcampus.adapter.MoreNewsAdapter)1 GridItemDecoration (com.itculturalfestival.smartcampus.utils.ItemDecoration.GridItemDecoration)1