Inherited This library allows you to easily achieve the drop-down refresh and upload more
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
compile 'com.github.anzaizai:EasyRefreshLayout:1.3.0'
<com.ajguan.library.EasyRefreshLayout
android:id="@+id/easylayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.ajguan.library.EasyRefreshLayout>
easyRefreshLayout.addEasyEvent(new EasyRefreshLayout.EasyEvent() {
@Override
public void onLoadMore() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
final List<String> list = new ArrayList<>();
for (int j = 0; j < 5; j++) {
list.add("this is new load data >>>>" + new Date().toLocaleString());
}
//adapter.addData(list);
easyRefreshLayout.loadMoreComplete(new EasyRefreshLayout.Event() {
@Override
public void complete() {
adapter.getData().addAll(list);
adapter.notifyDataSetChanged();
}
}, 500);
}
}, 2000);
}
@Override
public void onRefreshing() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
List<String> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
list.add("this is refresh data >>>" + new Date().toLocaleString());
}
adapter.setNewData(list);
easyRefreshLayout.refreshComplete();
Toast.makeText(getApplicationContext(), "refresh success", Toast.LENGTH_SHORT).show();
}
}, 1000);
}
});
easyRefreshLayout.setLoadMoreModel(LoadModel.NONE);
// 普通加载
easyRefreshLayout.setLoadMoreModel(LoadModel.COMMON_MODEL);
or
//预加载 advanceCount为剩余数据为advanceCount时触发预加载事件
easyRefreshLayout.setLoadMoreModel(LoadModel.ADVANCE_MODEL,advanceCount);
easyRefreshLayout.setRefreshHeadView(customizabaleView);
easyRefreshLayout.setLoadMoreView(customizabaleView);
for more information on how to use it,see demo on github https://github.com/anzaizai/EasyRefreshLayout
$ claude mcp add EasyRefreshLayout \
-- python -m otcore.mcp_server <graph>