Search in sources :

Example 1 with BezierLayout

use of com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout in project TwinklingRefreshLayout by lcodecorex.

the class FoodActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView rv) {
    rv.setLayoutManager(new LinearLayoutManager(rv.getContext()));
    foodAdapter = new FoodAdapter();
    rv.setAdapter(foodAdapter);
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    //        ProgressLayout headerView = new ProgressLayout(getContext());
    BezierLayout headerView = new BezierLayout(this);
    refreshLayout.setHeaderView(headerView);
    //        refreshLayout.setFloatRefresh(false);
    refreshLayout.setPureScrollModeOn(true);
    //        refreshLayout.setEnableOverlayRefreshView(false);
    //        refreshLayout.setAutoLoadMore(true);
    refreshCard();
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) FoodAdapter(com.lcodecore.twinklingrefreshlayout.adapter.FoodAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BezierLayout(com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)

Example 2 with BezierLayout

use of com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout 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 3 with BezierLayout

use of com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout 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)

Aggregations

TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)3 BezierLayout (com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)3 Handler (android.os.Handler)2 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)2 RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)2 PhotoAdapter (com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 FoodAdapter (com.lcodecore.twinklingrefreshlayout.adapter.FoodAdapter)1