use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.
the class ScienceActivity method setupGridView.
private void setupGridView(GridView gridView) {
final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
SinaRefreshView headerView = new SinaRefreshView(this);
headerView.setArrowResource(R.drawable.arrow);
headerView.setTextColor(0xff745D5C);
// TextHeaderView headerView = (TextHeaderView) View.inflate(this,R.layout.header_tv,null);
refreshLayout.setHeaderView(headerView);
LoadingView loadingView = new LoadingView(this);
refreshLayout.setBottomView(loadingView);
adapter = new ScienceAdapter();
gridView.setAdapter(adapter);
adapter.refreshCard();
gridView.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);
}
});
}
use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.
the class StoryActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_story);
TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
// ProgressLayout header = new ProgressLayout(this);
// refreshLayout.setHeaderView(header);
// refreshLayout.setFloatRefresh(true);
refreshLayout.setOverScrollRefreshShow(false);
refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {
@Override
public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refreshLayout.finishRefreshing();
}
}, 4000);
}
@Override
public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refreshLayout.finishLoadmore();
}
}, 4000);
}
});
}
use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter in project TwinklingRefreshLayout by lcodecorex.
the class WebActivity method onCreate.
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refreshLayout);
ProgressLayout header = new ProgressLayout(this);
refreshLayout.setHeaderView(header);
refreshLayout.setFloatRefresh(true);
refreshLayout.setOverScrollRefreshShow(false);
refreshLayout.setHeaderHeight(140);
refreshLayout.setMaxHeadHeight(240);
refreshLayout.setOverScrollHeight(200);
refreshLayout.setEnableLoadmore(false);
header.setColorSchemeResources(R.color.Blue, R.color.Orange, R.color.Yellow, R.color.Green);
// header.setColorSchemeColors(0xff4674e7,0xff0ba62c);
mWebView = (WebView) findViewById(R.id.webView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("https://dribbble.com/shots");
refreshLayout.startRefresh();
refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {
@Override
public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refreshLayout.finishRefreshing();
}
}, 4000);
}
});
}
use of com.lcodecore.tkrefreshlayout.RefreshListenerAdapter 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);
}
});
}
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();
}
Aggregations