// Path: GalleryTest/app/src/main/java/test/mindorks/gallery/gallerytest/gallery/ImageTypeBig.java
// @NonReusable
// @Layout(R.layout.gallery_item_big)
// public class ImageTypeBig {
// 
//     @View(R.id.imageView)
//     private ImageView imageView;
// 
//     private String mUlr;
//     private Context mContext;
//     private PlaceHolderView mPlaceHolderView;
// 
//     public ImageTypeBig(Context context, PlaceHolderView placeHolderView, String ulr) {
//         mContext = context;
//         mPlaceHolderView = placeHolderView;
//         mUlr = ulr;
//     }
// 
//     @Resolve
//     private void onResolved() {
//         Glide.with(mContext).load(mUlr).into(imageView);
//     }
// 
//     @LongClick(R.id.imageView)
//     private void onLongClick(){
//         mPlaceHolderView.removeView(this);
//     }
// }
// 
// Path: GalleryTest/app/src/main/java/test/mindorks/gallery/gallerytest/gallery/ImageTypeSmallList.java
// @Animate(Animation.CARD_TOP_IN_DESC)
// @NonReusable
// @Layout(R.layout.gallery_item_small_list)
// public class ImageTypeSmallList {
// 
//     @View(R.id.placeholderview)
//     private PlaceHolderView mPlaceHolderView;
// 
//     private Context mContext;
//     private List<Image> mImageList;
// 
//     public ImageTypeSmallList(Context context, List<Image> imageList) {
//         mContext = context;
//         mImageList = imageList;
//     }
// 
//     @Resolve
//     private void onResolved() {
//         mPlaceHolderView.getBuilder()
//                 .setHasFixedSize(false)
//                 .setItemViewCacheSize(10)
//                 .setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
// 
//         for(Image image : mImageList) {
//             mPlaceHolderView.addView(new ImageTypeSmall(mContext, mPlaceHolderView, image.getImageUrl()));
//         }
//     }
// }


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.mindorks.placeholderview.PlaceHolderView;
import java.util.ArrayList;
import java.util.List;
import test.mindorks.gallery.gallerytest.gallery.ImageTypeBig;
import test.mindorks.gallery.gallerytest.gallery.ImageTypeSmallList;
package test.mindorks.gallery.gallerytest;





public class MainActivity extends AppCompatActivity {

    private PlaceHolderView mGalleryView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mGalleryView = (PlaceHolderView)findViewById(R.id.galleryView);
        setupGallery();

        findViewById(R.id.remove).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mGalleryView.removeAllViews();
            }
        });
    }

    private void setupGallery(){

        List<Image> imageList = Utils.loadImages(this.getApplicationContext());
        List<Image> newImageList = new ArrayList<>();
        for (int i = 0; i <  (imageList.size() > 10 ? 10 : imageList.size()); i++) {
            newImageList.add(imageList.get(i));
        }

// Path: GalleryTest/app/src/main/java/test/mindorks/gallery/gallerytest/gallery/ImageTypeBig.java
// @NonReusable
// @Layout(R.layout.gallery_item_big)
// public class ImageTypeBig {
// 
//     @View(R.id.imageView)
//     private ImageView imageView;
// 
//     private String mUlr;
//     private Context mContext;
//     private PlaceHolderView mPlaceHolderView;
// 
//     public ImageTypeBig(Context context, PlaceHolderView placeHolderView, String ulr) {
//         mContext = context;
//         mPlaceHolderView = placeHolderView;
//         mUlr = ulr;
//     }
// 
//     @Resolve
//     private void onResolved() {
//         Glide.with(mContext).load(mUlr).into(imageView);
//     }
// 
//     @LongClick(R.id.imageView)
//     private void onLongClick(){
//         mPlaceHolderView.removeView(this);
//     }
// }
// 
// Path: GalleryTest/app/src/main/java/test/mindorks/gallery/gallerytest/gallery/ImageTypeSmallList.java
// @Animate(Animation.CARD_TOP_IN_DESC)
// @NonReusable
// @Layout(R.layout.gallery_item_small_list)
// public class ImageTypeSmallList {
// 
//     @View(R.id.placeholderview)
//     private PlaceHolderView mPlaceHolderView;
// 
//     private Context mContext;
//     private List<Image> mImageList;
// 
//     public ImageTypeSmallList(Context context, List<Image> imageList) {
//         mContext = context;
//         mImageList = imageList;
//     }
// 
//     @Resolve
//     private void onResolved() {
//         mPlaceHolderView.getBuilder()
//                 .setHasFixedSize(false)
//                 .setItemViewCacheSize(10)
//                 .setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
// 
//         for(Image image : mImageList) {
//             mPlaceHolderView.addView(new ImageTypeSmall(mContext, mPlaceHolderView, image.getImageUrl()));
//         }
//     }
// }


// Path: GalleryTest/app/src/main/java/test/mindorks/gallery/gallerytest/MainActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.mindorks.placeholderview.PlaceHolderView;
import java.util.ArrayList;
import java.util.List;
import test.mindorks.gallery.gallerytest.gallery.ImageTypeBig;
import test.mindorks.gallery.gallerytest.gallery.ImageTypeSmallList;

package test.mindorks.gallery.gallerytest;





public class MainActivity extends AppCompatActivity {

    private PlaceHolderView mGalleryView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mGalleryView = (PlaceHolderView)findViewById(R.id.galleryView);
        setupGallery();

        findViewById(R.id.remove).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mGalleryView.removeAllViews();
            }
        });
    }

    private void setupGallery(){

        List<Image> imageList = Utils.loadImages(this.getApplicationContext());
        List<Image> newImageList = new ArrayList<>();
        for (int i = 0; i <  (imageList.size() > 10 ? 10 : imageList.size()); i++) {
            newImageList.add(imageList.get(i));
        }

        mGalleryView.addView(new ImageTypeSmallList(this.getApplicationContext(), newImageList));