use of com.shizhefei.test.view.adapters.ReBooksAdapter in project MVCHelper by LuckyJayce.
the class JellyHeaderFragment method onCreateViewLazy.
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_recyclerview);
coolRefreshView = (CoolRefreshView) findViewById(R.id.recyclerview_funnyRefreshView);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// 这个header要白色才能突出效果
coolRefreshView.setBackgroundColor(Color.WHITE);
JellyHeader jellyHeader = new JellyHeader(getContext());
jellyHeader.setDragLayoutColor(ContextCompat.getColor(getContext(), R.color.primary));
jellyHeader.setLoadingView(R.layout.layout_jelley_header);
coolRefreshView.setPullHeader(jellyHeader);
mvcHelper = new MVCCoolHelper<>(coolRefreshView);
mvcHelper.setDataSource(new BooksOkHttp_AsyncDataSource());
mvcHelper.setAdapter(new ReBooksAdapter(getContext()));
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.ReBooksAdapter in project MVCHelper by LuckyJayce.
the class UltraRecyclerViewActivity 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));
mvcHelper = new MVCUltraHelper<>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new BooksDataSource());
// 设置适配器
mvcHelper.setAdapter(new ReBooksAdapter(this));
// 加载数据
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.ReBooksAdapter in project MVCHelper by LuckyJayce.
the class MaterialHeaderFragment method onCreateViewLazy.
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_recyclerview);
coolRefreshView = (CoolRefreshView) findViewById(R.id.recyclerview_funnyRefreshView);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_recyclerView);
coolRefreshView.setPullHeader(new MaterialHeader(getContext()));
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mvcHelper = new MVCCoolHelper<>(coolRefreshView);
mvcHelper.setDataSource(new BooksOkHttp_AsyncDataSource());
mvcHelper.setAdapter(new ReBooksAdapter(getContext()));
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.ReBooksAdapter in project MVCHelper by LuckyJayce.
the class StateHeaderFragment method onCreateViewLazy.
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_recyclerview);
coolRefreshView = (CoolRefreshView) findViewById(R.id.recyclerview_funnyRefreshView);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_recyclerView);
coolRefreshView.setPullHeader(new DefaultHeader());
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mvcHelper = new MVCCoolHelper<>(coolRefreshView);
mvcHelper.setDataSource(new BooksOkHttp_AsyncDataSource());
// mvcHelper.setAdapter(adapter = new ReBooksAdapter(getContext()));
// 这里模拟viewAdapter 和 dataAdapter不是同一个的情况
mvcHelper.setAdapter2(adapter = new ReBooksAdapter(getContext()), new IDataAdapter<List<Book>>() {
@Override
public void notifyDataChanged(List<Book> books, boolean isRefresh) {
if (books.size() > 5) {
adapter.notifyDataChanged(books.subList(0, 5), isRefresh);
} else {
adapter.notifyDataChanged(books, isRefresh);
}
}
@Override
public List<Book> getData() {
return adapter.getData();
}
@Override
public boolean isEmpty() {
return adapter.isEmpty();
}
});
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.ReBooksAdapter in project MVCHelper by LuckyJayce.
the class PinContentMaterialHeaderFragment method onCreateViewLazy.
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_recyclerview);
coolRefreshView = (CoolRefreshView) findViewById(R.id.recyclerview_funnyRefreshView);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_recyclerView);
coolRefreshView.setPullHeader(new MaterialHeader(getContext()), true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mvcHelper = new MVCCoolHelper<>(coolRefreshView);
mvcHelper.setDataSource(new BooksOkHttp_AsyncDataSource());
mvcHelper.setAdapter(new ReBooksAdapter(getContext()));
mvcHelper.refresh();
}
Aggregations