Search in sources :

Example 6 with TwinklingRefreshLayout

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

the class MusicActivity method setupListView.

private void setupListView(ListView listView) {
    TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    ProgressLayout headerView = new ProgressLayout(this);
    refreshLayout.setHeaderView(headerView);
    View exHeader = View.inflate(this, R.layout.header_music, null);
    refreshLayout.addFixedExHeader(exHeader);
    refreshLayout.setOverScrollRefreshShow(false);
    //        refreshLayout.setFloatRefresh(true);
    adapter = new MusicAdapter();
    listView.setAdapter(adapter);
    adapter.refreshCard();
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            ToastUtil.show("item clicked!");
        }
    });
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

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

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

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

                @Override
                public void run() {
                    adapter.loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
}
Also used : Handler(android.os.Handler) ProgressLayout(com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) MusicAdapter(com.lcodecore.twinklingrefreshlayout.adapter.MusicAdapter) AdapterView(android.widget.AdapterView)

Example 7 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout 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 8 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout 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 9 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout 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 10 with TwinklingRefreshLayout

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

Aggregations

TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)11 RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)10 Handler (android.os.Handler)7 View (android.view.View)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 RecyclerView (android.support.v7.widget.RecyclerView)4 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)3 QuickReturnTopManager (com.itculturalfestival.smartcampus.utils.QuickReturnTopManager)3 BezierLayout (com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)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 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