// Path: library-lis/src/main/java/com/cocolover2/lis/utils/ImageCache.java
// public class ImageCache {
//     private static LruCache<String, Bitmap> mCache;
// 
//     private ImageCache() {
//     }
// 
//     public static LruCache<String, Bitmap> getInstance() {
//         if (mCache == null)
//             synchronized (ImageCache.class) {
//                 if (mCache == null)
//                     mCache = new LruCache<String, Bitmap>((int) Runtime.getRuntime().maxMemory() / 8) {
//                         @Override
//                         protected int sizeOf(String key, Bitmap value) {
//                             if (Build.VERSION.SDK_INT > 12)
//                                 return value.getByteCount();
//                             else
//                                 return value.getRowBytes() * value.getHeight();
//                         }
//                     };
//             }
//         return mCache;
//     }
// }
// 
// Path: library-lis/src/main/java/com/cocolover2/lis/utils/ImageUtils.java
// public class ImageUtils {
//     private ImageUtils() {
//         throw new UnsupportedOperationException("cannot be instantiated");
//     }
// 
//     /**
//      * 压缩图片的像素
//      *
//      * @param path
//      * @param requestWidth
//      * @param requestHeight
//      * @return
//      */
//     public static Bitmap compressImgBySize(String path, int requestWidth, int requestHeight) {
//         if (null == path || TextUtils.isEmpty(path) || !new File(path).exists())
//             return null;
//         //第一次解析图片的时候将inJustDecodeBounds设置为true,来获取图片的大小
//         BitmapFactory.Options options = new BitmapFactory.Options();
//         options.inJustDecodeBounds = true;
//         BitmapFactory.decodeFile(path, options);
//         options.inSampleSize = calculateInSampleSize(options, requestWidth, requestHeight);
//         options.inJustDecodeBounds = false;
//         return BitmapFactory.decodeFile(path, options);
//     }
// 
//     private static int calculateInSampleSize(BitmapFactory.Options options, int requestWidth, int requestHeight) {
//         int width = options.outWidth;
//         int height = options.outHeight;
//         int inSampleSize = 1;
//         if (width > requestWidth || height > requestHeight) {
//             final int heightRatio = Math.round((float) height / (float) requestHeight);
//             final int widthRatio = Math.round((float) width / (float) requestWidth);
//             inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
//         }
//         return inSampleSize;
//     }
// }


import android.graphics.Bitmap;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.widget.AbsListView;
import android.widget.ImageView;
import com.cocolover2.lis.utils.ImageCache;
import com.cocolover2.lis.utils.ImageUtils;
import java.util.LinkedList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
            if (imageView.getTag().toString().equals(path) && bm != null) {
                imageView.setImageBitmap(bm);
            }
        }
    }

    /**
     * 添加一个任务
     *
     * @param runnable
     */
    private synchronized void addTask(Runnable runnable) {
        try {
            // 请求信号量，防止mPoolThreadHander为null
            if (mPoolThreadHander == null)
                mSemaphore.acquire();
        } catch (InterruptedException e) {
        }
        mTasks.add(runnable);
        mPoolThreadHander.sendEmptyMessage(0x110);
    }

    /**
     * 取出一个任务
     *
     * @return
     */
    private synchronized Runnable getTask() {
        if (mTasks.size() == 0)
            return null;
// Path: library-lis/src/main/java/com/cocolover2/lis/utils/ImageCache.java
// public class ImageCache {
//     private static LruCache<String, Bitmap> mCache;
// 
//     private ImageCache() {
//     }
// 
//     public static LruCache<String, Bitmap> getInstance() {
//         if (mCache == null)
//             synchronized (ImageCache.class) {
//                 if (mCache == null)
//                     mCache = new LruCache<String, Bitmap>((int) Runtime.getRuntime().maxMemory() / 8) {
//                         @Override
//                         protected int sizeOf(String key, Bitmap value) {
//                             if (Build.VERSION.SDK_INT > 12)
//                                 return value.getByteCount();
//                             else
//                                 return value.getRowBytes() * value.getHeight();
//                         }
//                     };
//             }
//         return mCache;
//     }
// }
// 
// Path: library-lis/src/main/java/com/cocolover2/lis/utils/ImageUtils.java
// public class ImageUtils {
//     private ImageUtils() {
//         throw new UnsupportedOperationException("cannot be instantiated");
//     }
// 
//     /**
//      * 压缩图片的像素
//      *
//      * @param path
//      * @param requestWidth
//      * @param requestHeight
//      * @return
//      */
//     public static Bitmap compressImgBySize(String path, int requestWidth, int requestHeight) {
//         if (null == path || TextUtils.isEmpty(path) || !new File(path).exists())
//             return null;
//         //第一次解析图片的时候将inJustDecodeBounds设置为true,来获取图片的大小
//         BitmapFactory.Options options = new BitmapFactory.Options();
//         options.inJustDecodeBounds = true;
//         BitmapFactory.decodeFile(path, options);
//         options.inSampleSize = calculateInSampleSize(options, requestWidth, requestHeight);
//         options.inJustDecodeBounds = false;
//         return BitmapFactory.decodeFile(path, options);
//     }
// 
//     private static int calculateInSampleSize(BitmapFactory.Options options, int requestWidth, int requestHeight) {
//         int width = options.outWidth;
//         int height = options.outHeight;
//         int inSampleSize = 1;
//         if (width > requestWidth || height > requestHeight) {
//             final int heightRatio = Math.round((float) height / (float) requestHeight);
//             final int widthRatio = Math.round((float) width / (float) requestWidth);
//             inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
//         }
//         return inSampleSize;
//     }
// }


// Path: library-lis/src/main/java/com/cocolover2/lis/LocalImageLoader.java
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.widget.AbsListView;
import android.widget.ImageView;
import com.cocolover2.lis.utils.ImageCache;
import com.cocolover2.lis.utils.ImageUtils;
import java.util.LinkedList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;

            if (imageView.getTag().toString().equals(path) && bm != null) {
                imageView.setImageBitmap(bm);
            }
        }
    }

    /**
     * 添加一个任务
     *
     * @param runnable
     */
    private synchronized void addTask(Runnable runnable) {
        try {
            // 请求信号量，防止mPoolThreadHander为null
            if (mPoolThreadHander == null)
                mSemaphore.acquire();
        } catch (InterruptedException e) {
        }
        mTasks.add(runnable);
        mPoolThreadHander.sendEmptyMessage(0x110);
    }

    /**
     * 取出一个任务
     *
     * @return
     */
    private synchronized Runnable getTask() {
        if (mTasks.size() == 0)
            return null;
        if (mType == Type.FIFO) {