// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java
// public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> {
//     public CustomImageModelLoader(Context context) {
//         super(context);
//     }
// 
//     @Override
//     protected String getUrl(CustomImageSizeModel model, int width, int height) {
//         return model.requestCustomSizeUrl(width, height);
//     }
// }
// 
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java
// public interface CustomImageSizeModel {
//     String requestCustomSizeUrl(int width, int height);
// 
//     String getBaseUrl();
// }
// 
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java
// public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable {
//     private String baseUrl;
//     private static final String TAG = "CustomImageSizeModelImp";
// 
//     public CustomImageSizeModelImp(String baseUrl) {
//         this.baseUrl = baseUrl;
//     }
// 
// 
//     @Override
//     public String requestCustomSizeUrl(int width, int height) {
//         String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width;
//         Log.d(TAG, "requestCustomSizeUrl: " + url);
//         return url;
//     }
// 
//     @Override
//     public String getBaseUrl() {
//         return baseUrl;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(this.baseUrl);
//     }
// 
//     protected CustomImageSizeModelImp(Parcel in) {
//         this.baseUrl = in.readString();
//     }
// 
//     public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() {
//         @Override
//         public CustomImageSizeModelImp createFromParcel(Parcel source) {
//             return new CustomImageSizeModelImp(source);
//         }
// 
//         @Override
//         public CustomImageSizeModelImp[] newArray(int size) {
//             return new CustomImageSizeModelImp[size];
//         }
//     };
// }


import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.DrawableRequestBuilder;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import example.com.glidesample.glide.CustomImageModelLoader;
import example.com.glidesample.R;
import example.com.glidesample.model.CustomImageSizeModel;
import example.com.glidesample.model.CustomImageSizeModelImp;
import uk.co.senab.photoview.PhotoViewAttacher;
        }

        @Override
        public View instantiateItem(ViewGroup container, final int position) {
            View parent = LayoutInflater.from(container.getContext()).inflate(R.layout.activity_image_detial, container, false);
            container.addView(parent);
            View downLoad = parent.findViewById(R.id.tvDownload);
            View loading = parent.findViewById(R.id.progressBar);
            downLoad.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    downloadImage(mDatas.get(position).getBaseUrl());
                }
            });
            downLoad.setTag(mDatas.get(position).getBaseUrl());
            ImageView imageView = (ImageView) parent.findViewById(R.id.imageView);
            displayImage(mDatas.get(position), imageView, loading, downLoad);
            return parent;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java
// public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> {
//     public CustomImageModelLoader(Context context) {
//         super(context);
//     }
// 
//     @Override
//     protected String getUrl(CustomImageSizeModel model, int width, int height) {
//         return model.requestCustomSizeUrl(width, height);
//     }
// }
// 
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java
// public interface CustomImageSizeModel {
//     String requestCustomSizeUrl(int width, int height);
// 
//     String getBaseUrl();
// }
// 
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java
// public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable {
//     private String baseUrl;
//     private static final String TAG = "CustomImageSizeModelImp";
// 
//     public CustomImageSizeModelImp(String baseUrl) {
//         this.baseUrl = baseUrl;
//     }
// 
// 
//     @Override
//     public String requestCustomSizeUrl(int width, int height) {
//         String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width;
//         Log.d(TAG, "requestCustomSizeUrl: " + url);
//         return url;
//     }
// 
//     @Override
//     public String getBaseUrl() {
//         return baseUrl;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(this.baseUrl);
//     }
// 
//     protected CustomImageSizeModelImp(Parcel in) {
//         this.baseUrl = in.readString();
//     }
// 
//     public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() {
//         @Override
//         public CustomImageSizeModelImp createFromParcel(Parcel source) {
//             return new CustomImageSizeModelImp(source);
//         }
// 
//         @Override
//         public CustomImageSizeModelImp[] newArray(int size) {
//             return new CustomImageSizeModelImp[size];
//         }
//     };
// }


// Path: glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.DrawableRequestBuilder;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import example.com.glidesample.glide.CustomImageModelLoader;
import example.com.glidesample.R;
import example.com.glidesample.model.CustomImageSizeModel;
import example.com.glidesample.model.CustomImageSizeModelImp;
import uk.co.senab.photoview.PhotoViewAttacher;

        }

        @Override
        public View instantiateItem(ViewGroup container, final int position) {
            View parent = LayoutInflater.from(container.getContext()).inflate(R.layout.activity_image_detial, container, false);
            container.addView(parent);
            View downLoad = parent.findViewById(R.id.tvDownload);
            View loading = parent.findViewById(R.id.progressBar);
            downLoad.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    downloadImage(mDatas.get(position).getBaseUrl());
                }
            });
            downLoad.setTag(mDatas.get(position).getBaseUrl());
            ImageView imageView = (ImageView) parent.findViewById(R.id.imageView);
            displayImage(mDatas.get(position), imageView, loading, downLoad);
            return parent;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        void displayImage(final CustomImageSizeModel model, final ImageView imageView, final View loading, final View download) {