package com.veinhorn.scrollgalleryview.example.builder;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.veinhorn.scrollgalleryview.ScrollGalleryView;
import com.veinhorn.scrollgalleryview.builder.GallerySettings;

import static com.veinhorn.scrollgalleryview.loader.picasso.dsl.DSL.*;

public class MainActivity extends FragmentActivity {
    private ScrollGalleryView galleryView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        galleryView = ScrollGalleryView
                .from((ScrollGalleryView) findViewById(R.id.scroll_gallery_view))
                .settings(
                        GallerySettings
                                .from(getSupportFragmentManager())
                                .thumbnailSize(100)
                                .enableZoom(true)
                                .build()
                )
                .onImageClickListener(new ScrollGalleryView.OnImageClickListener() {
                    @Override
                    public void onClick(int position) {
                        Toast.makeText(MainActivity.this, "image position = " + position, Toast.LENGTH_SHORT).show();
                    }
                })
                .onImageLongClickListener(new ScrollGalleryView.OnImageLongClickListener() {
                    @Override
                    public void onClick(int position) {
                        Toast.makeText(MainActivity.this, "image position = " + position, Toast.LENGTH_SHORT).show();
                    }
                })
                .add(images(
                        "http://pirate-islands.com/wp-content/uploads/2018/07/07_Dom-Fernando-II_01-636x310.jpg",
                        "http://povodu.ru/wp-content/uploads/2016/04/pochemu-korabl-derzitsa-na-vode.jpg"
                ))
                .add(video("http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4", R.mipmap.default_video))
                .build();
    }
}

@@ -154,16 +154,65 @@
 Toast;%0A%0A
+import com.veinhorn.scrollgalleryview.MediaInfo;%0A
 import c
@@ -322,16 +322,89 @@
 ettings;
+%0Aimport com.veinhorn.scrollgalleryview.loader.picasso.PicassoImageLoader;
 %0A%0Aimport
@@ -1845,149 +1845,9 @@
 mage
-s(%0A                        %22http://pirate-islands.com/wp-content/uploads/2018/07/07_Dom-Fernando-II_01-636x310.jpg%22,%0A                        
+(
 %22htt
@@ -1923,33 +1923,16 @@
 ode.jpg%22
-%0A                
 ))%0A     
@@ -2069,22 +2069,641 @@
        .
-build(
+add(image(%0A                        %22https://i.pinimg.com/originals/1b/d3/f0/1bd3f0e146da86f9c504e89a0b7e1403.jpg%22,%0A                        %22Old Ship%22%0A                ))%0A                .build();%0A%0A                galleryView.addMedia(MediaInfo.mediaLoader(%0A                        new PicassoImageLoader(%22https://upload.wikimedia.org/wikipedia/commons/thumb/8/81/USRC_Salmon_P_Chase_-_LoC_4a25817u.jpg/1200px-USRC_Salmon_P_Chase_-_LoC_4a25817u.jpg%22),%0A                        %22The word barque entered English via French, which in turn came from the Latin barca by way of Occitan, Catalan, Spanish or Italian.%22%0A                )
 );%0A    %7D

update builder_example app