Search in sources :

Example 1 with GridViewHandler

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();
}
Also used : BooksOkHttp_AsyncDataSource(com.shizhefei.test.models.datasource.okhttp.BooksOkHttp_AsyncDataSource) BooksAdapter(com.shizhefei.test.view.adapters.BooksAdapter) List(java.util.List) GridViewHandler(in.srain.cube.views.GridViewHandler) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 BooksOkHttp_AsyncDataSource (com.shizhefei.test.models.datasource.okhttp.BooksOkHttp_AsyncDataSource)1 BooksAdapter (com.shizhefei.test.view.adapters.BooksAdapter)1 GridViewHandler (in.srain.cube.views.GridViewHandler)1 List (java.util.List)1