diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/ProductAdapter.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/ProductAdapter.java index 4ee2695..85ccfee 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/ProductAdapter.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/ProductAdapter.java @@ -7,7 +7,9 @@ import com.hannesdorfmann.mosby.mvp.MvpView; import com.mateuszkoslacz.moviper.base.view.MvpRecyclerViewAdapter; import com.mateuszkoslacz.moviper.base.view.MvpBaseViewHolder; +import com.mateuszkoslacz.moviper.recyclerviewsample.viper.view.adapter.agregate.HeaderListingItem; import com.mateuszkoslacz.moviper.recyclerviewsample.viper.view.adapter.agregate.ListingItem; +import com.mateuszkoslacz.moviper.recyclerviewsample.viper.view.adapter.agregate.ProductListingItem; import com.mateuszkoslacz.moviper.recyclerviewsample.viper.view.adapter.delegate.HeaderAdapterDelegate; import com.mateuszkoslacz.moviper.recyclerviewsample.viper.view.adapter.delegate.ProductAdapterDelegate; @@ -23,14 +25,14 @@ public class ProductAdapter MvpBaseViewHolder> { private List mListingItems; - private AdapterDelegatesManager mDelegatesManager; + private AdapterDelegatesManager> mDelegatesManager; public ProductAdapter() { mListingItems = new ArrayList<>(); - mDelegatesManager = new AdapterDelegatesManager(); + mDelegatesManager = new AdapterDelegatesManager<>(); mDelegatesManager - .addDelegate(ListingItem.TYPE_HEADER, new HeaderAdapterDelegate()) - .addDelegate(ListingItem.TYPE_PRODUCT, new ProductAdapterDelegate()); + .addDelegate(HeaderListingItem.TYPE, new HeaderAdapterDelegate()) + .addDelegate(ProductListingItem.TYPE, new ProductAdapterDelegate()); } @Override diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/HeaderListingItem.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/HeaderListingItem.java index 927549d..d0db2cc 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/HeaderListingItem.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/HeaderListingItem.java @@ -8,6 +8,7 @@ public class HeaderListingItem implements ListingItem { + public static final int TYPE = HeaderListingItem.class.hashCode(); private Category mCategory; public HeaderListingItem(Category category) { @@ -16,7 +17,7 @@ public HeaderListingItem(Category category) { @Override public int getType() { - return ListingItem.TYPE_HEADER; + return TYPE; } public Category getCategory() { diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ListingItem.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ListingItem.java index 3ca8bd7..25c7e9b 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ListingItem.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ListingItem.java @@ -6,8 +6,5 @@ public interface ListingItem { - int TYPE_HEADER = 0; - int TYPE_PRODUCT = 1; - int getType(); } diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ProductListingItem.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ProductListingItem.java index 85ea6d2..cbc9424 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ProductListingItem.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/agregate/ProductListingItem.java @@ -8,6 +8,7 @@ public class ProductListingItem implements ListingItem { + public static final int TYPE = ProductListingItem.class.hashCode(); private Product mProduct; public ProductListingItem(Product product) { @@ -16,7 +17,7 @@ public ProductListingItem(Product product) { @Override public int getType() { - return ListingItem.TYPE_PRODUCT; + return TYPE; } public Product getProduct() { diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/HeaderAdapterDelegate.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/HeaderAdapterDelegate.java index cae459b..43dce82 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/HeaderAdapterDelegate.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/HeaderAdapterDelegate.java @@ -20,7 +20,7 @@ public class HeaderAdapterDelegate extends AdapterDelegate> { @Override protected boolean isForViewType(@NonNull List items, int position) { - return items.get(position).getType() == ListingItem.TYPE_HEADER; + return items.get(position).getType() == HeaderListingItem.TYPE; } @NonNull diff --git a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/ProductAdapterDelegate.java b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/ProductAdapterDelegate.java index e03252b..2e2568b 100644 --- a/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/ProductAdapterDelegate.java +++ b/sample-recyclerview/src/main/java/com/mateuszkoslacz/moviper/recyclerviewsample/viper/view/adapter/delegate/ProductAdapterDelegate.java @@ -20,7 +20,7 @@ public class ProductAdapterDelegate extends AdapterDelegate> { @Override protected boolean isForViewType(@NonNull List items, int position) { - return items.get(position).getType() == ListingItem.TYPE_PRODUCT; + return items.get(position).getType() == ProductListingItem.TYPE; } @NonNull