use of com.shizhefei.task.imp.MemoryCacheStore in project MVCHelper by LuckyJayce.
the class ListTaskActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ultrarecyclerview);
PtrClassicFrameLayout mPtrFrameLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
taskHelper = new TaskHelper<>(new MemoryCacheStore(200));
//注册全局的task执行回调
taskHelper.registerCallBack(new ICallback<MovieAmount>() {
@Override
public void onPreExecute(Object task) {
Log.d("pppp", "task:" + task);
}
@Override
public void onProgress(Object task, int percent, long current, long total, Object extraData) {
}
@Override
public void onPostExecute(Object task, Code code, Exception exception, MovieAmount movieAmount) {
Log.d("pppp", "task:" + task + " code:" + code);
}
});
mvcHelper = new MVCUltraHelper<>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new MoviesDataSource());
// 设置适配器
mvcHelper.setAdapter(new MoviesAdapter(taskHelper));
// 加载数据
mvcHelper.refresh();
}
Aggregations