use of in.srain.cube.views.GridViewHandler 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