I am having trouble trying to create an adapter for a TwoWayView from lucasar. https://github.com/lucasr/twoway-view
What I want is a facebook-style display for images. Sort of like this. facebook style image structure
I am currently trying to convert the LayoutAdapter.java file in the github repo under the sample folder into an Adapter that I can use in my project, but I think I need some more information on what exactly this adapter is doing.
Here is the xml for the TwoWayView grid.
<org.lucasr.twowayview.widget.TwoWayView
android:id="@+id/twvGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical"
app:twowayview_layoutManager="SpannableGridLayoutManager"
app:twowayview_numColumns="3"
app:twowayview_numRows="3"
android:layout_below="@+id/youtubeVidImage"
android:layout_gravity="center"
android:fitsSystemWindows="true"
android:layout_marginTop="35dp"/>
Each Item in the layout (GalleryItem) is essentially just a url of an image to be displayed. And I want to be able to add these images to the layout in the Activity that set up the TwoWayView. Something like this for the code in the Activity that initializes the mPhotos array.
private void initImagesRecyclerView(){
Log.d(TAG, "initImagesRecyclerView: init Recyclerview");
imagesRecyclerView = findViewById(R.id.twvGrid);
mPhotos = new ArrayList<GalleryItem>();
//mImagePostsAdapter = new ImagePostsAdapter(this,mPhotos);
//imagesRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL));
mImagePostsAdapter = new TwoWayViewAdapter(this,imagesRecyclerView,R.layout.layout_staggered_grid);
imagesRecyclerView.setAdapter(mImagePostsAdapter);
}
Can anyone give me some advice on how to implement the TwoWayView? Anything on how to make the adapter and how to set it to the TwoWayView reference in the Activity would be great.
Thanks