// Path: app/src/main/java/com/zmj/qvod/app/VideoApplication.java
// public class VideoApplication extends Application {
// 
//     private static VideoApplication videoApplication;
// 
//     public static VideoApplication getInstance() {
//         if (videoApplication == null) {
//             synchronized (VideoApplication.class) {
//                 if (videoApplication == null) {
//                     videoApplication = new VideoApplication();
//                 }
//             }
//         }
//         return videoApplication;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         videoApplication = this;
//         HttpUtils.getInstance().setContext(this);
//         JUtils.initialize(this);
//         JUtils.setDebug(true, "video");
//         initLoading();
//     }
// 
//     private void initLoading() {
//         LoadingLayout.getConfig()
//                 .setErrorText("出错啦~请稍后重试！")
//                 .setEmptyText("抱歉，暂无数据")
//                 .setNoNetworkText("无网络连接，请检查您的网络···")
//                 .setErrorImage(R.drawable.ic_empty_icon)
//                 .setEmptyImage(R.drawable.ic_empty_icon)
//                 .setNoNetworkImage(R.drawable.ic_no_network)
//                 .setAllTipTextColor(R.color.colorTabText)
//                 .setAllTipTextSize(14)
//                 .setReloadButtonText("点我重试哦")
//                 .setReloadButtonTextSize(14)
//                 .setReloadButtonTextColor(R.color.colorTabText)
//                 .setReloadButtonWidthAndHeight(150, 40)
//                 .setAllPageBackgroundColor(R.color.colorBackground)
//                 .setLoadingPageLayout(R.layout.default_loading_page);
//     }
// 
//     private VideoRes videoRes;
// 
//     public VideoRes getVideoRes() {
//         return videoRes;
//     }
// 
//     public void setVideoRes(VideoRes videoRes) {
//         this.videoRes = videoRes;
//     }
// }


import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.FutureTarget;
import com.zmj.qvod.R;
import com.zmj.qvod.app.VideoApplication;
import java.io.File;
import java.util.concurrent.ExecutionException;
package com.zmj.qvod.constant;




/**
 * Description: ImageLoader
 * Creator: zmj
 * date: 2017/02/21 9:53
 */
public class ImageLoader {

    public static void load(Context context, String url, ImageView iv) {    //使用Glide加载ImageView(如头像)时，不要使用占位图
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv);
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public static void load(Activity activity, String url, ImageView iv) {    //使用Glide加载ImageView(如头像)时，不要使用占位图
        if (!activity.isDestroyed()) {
            Glide.with(activity).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv);
        }
    }

    public static void loadAll(Context context, String url, ImageView iv) {    //不缓存，全部从网络加载
        Glide.with(context).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv);
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public static void loadAll(Activity activity, String url, ImageView iv) {    //不缓存，全部从网络加载
        if (!activity.isDestroyed()) {
            Glide.with(activity).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv);
        }
    }

    public static void load(String url, ImageView iv, int type) {    //使用占位图
        switch (type) {
            case 320:
                Glide.with(VideoApplication.getInstance()).load(url).crossFade(1500).placeholder(R.drawable.default_320).into(iv);
                break;
// Path: app/src/main/java/com/zmj/qvod/app/VideoApplication.java
// public class VideoApplication extends Application {
// 
//     private static VideoApplication videoApplication;
// 
//     public static VideoApplication getInstance() {
//         if (videoApplication == null) {
//             synchronized (VideoApplication.class) {
//                 if (videoApplication == null) {
//                     videoApplication = new VideoApplication();
//                 }
//             }
//         }
//         return videoApplication;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         videoApplication = this;
//         HttpUtils.getInstance().setContext(this);
//         JUtils.initialize(this);
//         JUtils.setDebug(true, "video");
//         initLoading();
//     }
// 
//     private void initLoading() {
//         LoadingLayout.getConfig()
//                 .setErrorText("出错啦~请稍后重试！")
//                 .setEmptyText("抱歉，暂无数据")
//                 .setNoNetworkText("无网络连接，请检查您的网络···")
//                 .setErrorImage(R.drawable.ic_empty_icon)
//                 .setEmptyImage(R.drawable.ic_empty_icon)
//                 .setNoNetworkImage(R.drawable.ic_no_network)
//                 .setAllTipTextColor(R.color.colorTabText)
//                 .setAllTipTextSize(14)
//                 .setReloadButtonText("点我重试哦")
//                 .setReloadButtonTextSize(14)
//                 .setReloadButtonTextColor(R.color.colorTabText)
//                 .setReloadButtonWidthAndHeight(150, 40)
//                 .setAllPageBackgroundColor(R.color.colorBackground)
//                 .setLoadingPageLayout(R.layout.default_loading_page);
//     }
// 
//     private VideoRes videoRes;
// 
//     public VideoRes getVideoRes() {
//         return videoRes;
//     }
// 
//     public void setVideoRes(VideoRes videoRes) {
//         this.videoRes = videoRes;
//     }
// }


// Path: app/src/main/java/com/zmj/qvod/constant/ImageLoader.java
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.FutureTarget;
import com.zmj.qvod.R;
import com.zmj.qvod.app.VideoApplication;
import java.io.File;
import java.util.concurrent.ExecutionException;

package com.zmj.qvod.constant;




/**
 * Description: ImageLoader
 * Creator: zmj
 * date: 2017/02/21 9:53
 */
public class ImageLoader {

    public static void load(Context context, String url, ImageView iv) {    //使用Glide加载ImageView(如头像)时，不要使用占位图
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv);
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public static void load(Activity activity, String url, ImageView iv) {    //使用Glide加载ImageView(如头像)时，不要使用占位图
        if (!activity.isDestroyed()) {
            Glide.with(activity).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv);
        }
    }

    public static void loadAll(Context context, String url, ImageView iv) {    //不缓存，全部从网络加载
        Glide.with(context).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv);
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public static void loadAll(Activity activity, String url, ImageView iv) {    //不缓存，全部从网络加载
        if (!activity.isDestroyed()) {
            Glide.with(activity).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv);
        }
    }

    public static void load(String url, ImageView iv, int type) {    //使用占位图
        switch (type) {
            case 320:
                Glide.with(VideoApplication.getInstance()).load(url).crossFade(1500).placeholder(R.drawable.default_320).into(iv);
                break;
            case 200: