use of com.lcodecore.twinklingrefreshlayout.adapter.MusicAdapter 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);
}
});
}
Aggregations