Search in sources :

Example 1 with ProductsAdapter

use of com.github.asifmujteba.easyvolleysample.UI.adapters.ProductsAdapter in project EasyVolley by asifmujteba.

the class ProductsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    productsAdapter = new ProductsAdapter(mContext, new ArrayList<Product>());
    gridView.setEmptyView(emptyElement);
    gridView.setAdapter(productsAdapter);
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Product product = productsAdapter.getItem(position);
            DetailsActivity.launch(mContext, product, (ImageView) view.findViewById(R.id.imageView));
        }
    });
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            loadProducts();
        }
    });
    loadProducts();
}
Also used : ArrayList(java.util.ArrayList) Product(com.github.asifmujteba.easyvolleysample.Models.Product) GridView(android.widget.GridView) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) ProductsAdapter(com.github.asifmujteba.easyvolleysample.UI.adapters.ProductsAdapter) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 GridView (android.widget.GridView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 InjectView (butterknife.InjectView)1 Product (com.github.asifmujteba.easyvolleysample.Models.Product)1 ProductsAdapter (com.github.asifmujteba.easyvolleysample.UI.adapters.ProductsAdapter)1 ArrayList (java.util.ArrayList)1