diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 26cc9d8..198b771 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,8 +3,9 @@
\ No newline at end of file
diff --git a/.idea/libraries/recyclerview_v7_23_1_1.xml b/.idea/libraries/recyclerview_v7_23_1_1.xml
index 714e51d..9151788 100644
--- a/.idea/libraries/recyclerview_v7_23_1_1.xml
+++ b/.idea/libraries/recyclerview_v7_23_1_1.xml
@@ -4,12 +4,12 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_1_1.xml b/.idea/libraries/support_annotations_23_1_1.xml
index 9d88cba..423cbab 100644
--- a/.idea/libraries/support_annotations_23_1_1.xml
+++ b/.idea/libraries/support_annotations_23_1_1.xml
@@ -1,11 +1,11 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_1_1.xml b/.idea/libraries/support_v4_23_1_1.xml
index 0c35e8b..e7df03d 100644
--- a/.idea/libraries/support_v4_23_1_1.xml
+++ b/.idea/libraries/support_v4_23_1_1.xml
@@ -4,13 +4,13 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 6b8fbd7..5d19981 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,6 @@
-
-
-
-
-
-
-
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 429b5e1..6b3e0f8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,16 +4,58 @@
+
+
+
+ @android:style/Theme.Material.Light
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -42,37 +84,38 @@
-
-
+
+
-
-
+
+
-
+
+
-
-
+
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
+
@@ -81,19 +124,27 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
@@ -101,6 +152,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -112,15 +173,7 @@
-
-
-
-
-
-
-
-
@@ -560,6 +613,11 @@
+
+
+
+
+
@@ -1194,6 +1252,11 @@
+
+
+
+
+
@@ -1988,7 +2051,7 @@
@@ -2021,8 +2084,8 @@
-
-
+
+
@@ -2049,10 +2112,8 @@
-
-
-
-
+
+
@@ -2063,18 +2124,15 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -2091,16 +2149,13 @@
-
-
+
-
-
-
-
+
+
@@ -2111,8 +2166,7 @@
-
-
+
@@ -2142,8 +2196,8 @@
-
-
+
+
@@ -2170,10 +2224,8 @@
-
-
-
-
+
+
@@ -2184,18 +2236,15 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -2212,16 +2261,13 @@
-
-
+
-
-
-
-
+
+
@@ -2232,12 +2278,13 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -2267,8 +2314,8 @@
-
-
+
+
@@ -2295,10 +2342,8 @@
-
-
-
-
+
+
@@ -2309,18 +2354,15 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -2337,16 +2379,13 @@
-
-
+
-
-
-
-
+
+
@@ -2357,12 +2396,11 @@
-
-
-
-
-
-
+
+
+
+
+
@@ -2374,119 +2412,119 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2503,39 +2541,33 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
@@ -2545,8 +2577,8 @@
-
-
+
+
@@ -2559,7 +2591,7 @@
-
+
@@ -2571,8 +2603,7 @@
-
-
+
@@ -2597,152 +2628,94 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
+
+
+
-
-
-
+
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
@@ -2752,27 +2725,17 @@
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
@@ -2809,7 +2772,10 @@
-
+
+
+
+
@@ -2854,31 +2820,23 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
@@ -2903,87 +2861,50 @@
-
- 1449758394078
+
+ 1450374945138
- 1449758394078
-
-
- 1449994945236
-
-
- 1449994945236
-
-
- 1450268964045
-
-
- 1450268964045
+ 1450374945138
-
-
+
-
+
-
+
+
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2996,72 +2917,52 @@
-
-
-
-
-
-
-
-
-
-
+
+
+ file://$PROJECT_DIR$/snaplibrary/src/main/java/io/github/prashantsolanki3/snaplibrary/snap/endless/EndlessRecyclerOnScrollListener.java
+ 53
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
-
+
-
+
-
+
+
-
+
-
+
-
+
@@ -3071,83 +2972,93 @@
-
+
-
+
-
+
+
-
+
-
+
-
+
-
-
+
+
+
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
+
+
-
+
-
+
-
+
+
+
+
+
-
+
-
+
-
+
@@ -3155,348 +3066,205 @@
-
+
-
-
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
+
+
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
-
+
+
-
-
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
diff --git a/sample/build.gradle b/sample/build.gradle
index 8f28afa..e4f50b0 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -21,9 +21,10 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile project (":snaplibrary")
+ compile project(":snaplibrary")
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
-
+ compile 'com.github.bumptech.glide:glide:3.6.1'
+ compile 'com.android.support:design:23.1.1'
}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index af2ff32..94d5aa4 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,16 +1,19 @@
+ package="io.github.prashantsolanki3.snaprecyclerviewutils">
+
+
+
+ android:theme="@style/AppTheme">
+ android:name="io.prashantslolanki3.snaprecyclerview.sample.MultiLayoutActivity"
+ android:theme="@style/AppTheme.NoActionBar">
diff --git a/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/BaseRecyclerViewActivity.java b/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/BaseRecyclerViewActivity.java
new file mode 100644
index 0000000..e0505a6
--- /dev/null
+++ b/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/BaseRecyclerViewActivity.java
@@ -0,0 +1,42 @@
+package io.prashantslolanki3.snaprecyclerview.sample;
+
+import android.os.Bundle;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+
+import io.github.prashantsolanki3.snaprecyclerviewutils.R;
+
+public abstract class BaseRecyclerViewActivity extends AppCompatActivity {
+
+ RecyclerView recyclerView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_base_recycler_view);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ recyclerView = (RecyclerView) findViewById(R.id.recycler);
+ recyclerView.setHasFixedSize(true);
+ setLayoutManager(recyclerView);
+ setAdapter(recyclerView);
+ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_add_items);
+ fab.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setFabOnClickAction(view);
+ }
+ });
+ }
+
+ public abstract void setLayoutManager(RecyclerView recyclerView);
+
+ public abstract void setAdapter(RecyclerView recyclerView);
+
+ public abstract void setFabOnClickAction(View view);
+
+
+}
diff --git a/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/MultiLayoutActivity.java b/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/MultiLayoutActivity.java
new file mode 100644
index 0000000..df31766
--- /dev/null
+++ b/sample/src/main/java/io/prashantslolanki3/snaprecyclerview/sample/MultiLayoutActivity.java
@@ -0,0 +1,105 @@
+package io.prashantslolanki3.snaprecyclerview.sample;
+
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+import io.github.prashantsolanki3.snaplibrary.snap.AbstractSnapMultiAdapter;
+import io.github.prashantsolanki3.snaplibrary.snap.SnapLayoutWrapper;
+import io.github.prashantsolanki3.snaplibrary.snap.SnapMultiAdapter;
+import io.github.prashantsolanki3.snaplibrary.snap.endless.EndlessLoader;
+import io.github.prashantsolanki3.snaprecyclerviewutils.R;
+import io.prashantslolanki3.snaprecyclerview.sample.model.HorizontalRecyclerModel;
+import io.prashantslolanki3.snaprecyclerview.sample.model.PictureCaption;
+import io.prashantslolanki3.snaprecyclerview.sample.viewholders.HorizontalRecyclerViewHolder;
+import io.prashantslolanki3.snaprecyclerview.sample.viewholders.ImageViewHolder;
+import io.prashantslolanki3.snaprecyclerview.sample.viewholders.SinglePictureCaptionViewHolder;
+
+/**
+ * Package io.prashantslolanki3.snaprecyclerview.sample
+ *
+ * Created by Prashant on 12/18/2015.
+ *
+ * Email: solankisrp2@gmail.com
+ * Github: @prashantsolanki3
+ */
+public class MultiLayoutActivity extends BaseRecyclerViewActivity {
+
+ SnapMultiAdapter adapter;
+
+ @Override
+ public void setLayoutManager(RecyclerView recyclerView) {
+ recyclerView.setLayoutManager(new LinearLayoutManager(this));
+ }
+
+ @Override
+ public void setAdapter(final RecyclerView recyclerView) {
+ ArrayList wrappers = new ArrayList<>();
+ wrappers.add(new SnapLayoutWrapper(HorizontalRecyclerModel.class, HorizontalRecyclerViewHolder.class, R.layout.item_header_layout, 0));
+ wrappers.add(new SnapLayoutWrapper(String.class, ImageViewHolder.class, R.layout.item_image_layout, 1));
+ wrappers.add(new SnapLayoutWrapper(PictureCaption.class, SinglePictureCaptionViewHolder.class, R.layout.item_pictue_caption_layout, 2));
+ adapter = new SnapMultiAdapter(this, wrappers);
+ recyclerView.setAdapter(adapter);
+ adapter.setEndlessLoader(recyclerView, 5, new EndlessLoader