use of com.shizhefei.test.view.adapters.BooksAdapter in project MVCHelper by LuckyJayce.
the class SwipeRefreshActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swiperefresh);
// PullToRefreshListView refreshListView = (PullToRefreshListView)
// findViewById(R.id.pullToRefreshListView);
ListView listView = (ListView) findViewById(R.id.listView);
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
mvcHelper = new MVCSwipeRefreshHelper<>(swipeRefreshLayout);
// 设置数据源
mvcHelper.setDataSource(new BooksDataSource());
// 设置适配器
mvcHelper.setAdapter(new BooksAdapter(this));
// 加载数据
mvcHelper.refresh();
listView.setOnItemClickListener(onItemClickListener);
}
use of com.shizhefei.test.view.adapters.BooksAdapter in project MVCHelper by LuckyJayce.
the class PullrefshActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pullrefsh);
PullToRefreshListView refreshListView = (PullToRefreshListView) findViewById(R.id.pullToRefreshListView);
mvcHelper = new MVCPullrefshHelper<>(refreshListView);
// 设置数据源
mvcHelper.setDataSource(DataSources.concatWith(new InitTokenTask(), new BooksDataSource()));
// 设置适配器
mvcHelper.setAdapter(new BooksAdapter(this));
// 加载数据
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.BooksAdapter in project MVCHelper by LuckyJayce.
the class UltraActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ultra);
/*
* 配置PtrClassicFrameLayout的刷新样式
*/
PtrClassicFrameLayout mPtrFrameLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
final MaterialHeader header = new MaterialHeader(this);
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
header.setPadding(0, dipToPix(this, 15), 0, dipToPix(this, 10));
header.setPtrFrameLayout(mPtrFrameLayout);
mPtrFrameLayout.setLoadingMinTime(800);
mPtrFrameLayout.setDurationToCloseHeader(800);
mPtrFrameLayout.setHeaderView(header);
mPtrFrameLayout.addPtrUIHandler(header);
mvcHelper = new MVCUltraHelper<List<Book>>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new BooksDataSource());
// 设置适配器
mvcHelper.setAdapter(new BooksAdapter(this));
// 加载数据
mvcHelper.refresh();
}
use of com.shizhefei.test.view.adapters.BooksAdapter in project MVCHelper by LuckyJayce.
the class Volley_OKHttp_GridViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_girdview);
// PullToRefreshListView refreshListView = (PullToRefreshListView)
// findViewById(R.id.pullToRefreshListView);
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
// GridViewWithHeaderAndFooter gridViewWithHeaderAndFooter =
// (GridViewWithHeaderAndFooter) findViewById(R.id.girdView);
mvcHelper = new MVCSwipeRefreshHelper<List<Book>>(swipeRefreshLayout);
/**
* 设置数据源
*/
// 用okhttp 普通请求的例子
// mvcHelper.setDataSource(new BooksOkHttpNormal_DataSource());
// 用mvcelper-okhttp 异步执行的例子
mvcHelper.setDataSource(new BooksOkHttp_AsyncDataSource());
// 用mvcelper-okhttp 同步执行的例子
// mvcHelper.setDataSource(new BooksOkHttp_SyncDataSource());
// 用volley 例子
// mvcHelper.setDataSource(new BooksVolleyDataSource());
// 设置AsyncHttpClient 作为网络请求的数据源
// listViewHelper.setDataSource(new BooksOkHttpNormal_DataSource());
// 设置适配器
mvcHelper.setAdapter(new BooksAdapter(this), new GridViewHandler());
// 加载数据
mvcHelper.refresh();
}
Aggregations