diff --git a/gradle.properties b/gradle.properties index b31f40f..5ee0eea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,8 +15,8 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=1.2.2 -VERSION_CODE=14 +VERSION_NAME=1.2.3 +VERSION_CODE=15 GROUP=com.github.vivchar POM_DESCRIPTION=A single adapter with multiple view types for the whole project diff --git a/rendererrecyclerviewadapter/src/main/java/com/github/vivchar/rendererrecyclerviewadapter/CompositeViewRenderer.java b/rendererrecyclerviewadapter/src/main/java/com/github/vivchar/rendererrecyclerviewadapter/CompositeViewRenderer.java index 64db6f8..179bf2a 100644 --- a/rendererrecyclerviewadapter/src/main/java/com/github/vivchar/rendererrecyclerviewadapter/CompositeViewRenderer.java +++ b/rendererrecyclerviewadapter/src/main/java/com/github/vivchar/rendererrecyclerviewadapter/CompositeViewRenderer.java @@ -20,7 +20,6 @@ public abstract class CompositeViewRenderer mRenderers = new ArrayList<>(); - @Nullable private RendererRecyclerViewAdapter mAdapter; public CompositeViewRenderer(final int viewType, @NonNull final Context context) { @@ -41,6 +40,8 @@ public void bindView(@NonNull final M model, @NonNull final VH holder) { @NonNull @Override public VH createViewHolder(@Nullable final ViewGroup parent) { + mAdapter = createAdapter(); + for (final ViewRenderer renderer : mRenderers) { getAdapter().registerRenderer(renderer); } @@ -63,11 +64,7 @@ public CompositeViewRenderer registerRenderer(@NonNull final ViewRenderer render return this; } - @NonNull protected RendererRecyclerViewAdapter getAdapter() { - if (mAdapter == null) { - mAdapter = createAdapter(); - } return mAdapter; }