// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
//     @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
//     public static MusicBean parseMP3File(String path) {
//         MediaMetadataRetriever mmr = new MediaMetadataRetriever();
//         String name = null;
//         String singer = null;
//         String album = null;
//         long duration = 0;
// 
// 
//         try {
//             mmr.setDataSource(path);
//             name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
//             singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
//             album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
//             duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
//             mmr.release();
//         } catch (Exception e) {
//             e.printStackTrace();
//             return null;
// 
//         }
//         return new MusicBean(name, singer, album, duration, path);
//     }
// 
//     @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
//     public static Bitmap getAlbumArtFromMP3File(String path) {
//         MediaMetadataRetriever mmr = new MediaMetadataRetriever();
//         try {
//             mmr.setDataSource(path);
//         } catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             return null;
//         }
//         byte[] bytes = mmr.getEmbeddedPicture();
//         if (null != bytes) {
//             return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
//         } else {
//             return mmr.getFrameAtTime();
//         }
//     }
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
// 
//     public static boolean isMusic(File file) {
//         return null!=file && file.getName().toLowerCase().endsWith(".mp3");
//     }
// 
//     public static String getAlbumArt(Context mContext, String album_id) {
//         String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
//         Cursor cur = mContext.getContentResolver().query(
//                 MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
//                 projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
//         String album_art = null;
//         if (null!=cur && cur.moveToNext()) {
//             album_art = cur.getString(0);
//             cur.close();
//         }
// 
//         return album_art;
//     }
// 
//     public static String[] getParentAndFileName(String path) {
//         if (null!=path) {
//             int lastIndex = path.lastIndexOf(File.separatorChar);
//             if (lastIndex == path.length() - 1 && lastIndex > 0) {
//                 String tmp = path.substring(0, lastIndex);
//                 lastIndex = tmp.lastIndexOf(File.separatorChar);
//             }
//             String parent = path.substring(0, lastIndex+1);
//             String name = path.substring(lastIndex+1, path.length());
//             return new String[]{parent,name};
//         }
//         return new String[]{path,path};
//     }
// }


import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

        private boolean loadImg2Cache(final ImageView imageView, String path) {
            final String mPath = path;

            if (null == mPath) {
                return false;
            }
            if (null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
                return true;
            } else {
                Bitmap bitmap = null;
                String picPath = MusicUtil.getAlbumArt(context, mPath);
                if (null!=picPath) {

                }

                if (null != bitmap) {
                    final Bitmap finalBitmap = bitmap;
                    mMainHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (mPath.equals(imageView.getTag())) {
                                imageView.setImageBitmap(finalBitmap);
                            }
                        }
                    });
                    fstCacheMap.put(mPath, bitmap);
                    return true;
                } else {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
//     @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
//     public static MusicBean parseMP3File(String path) {
//         MediaMetadataRetriever mmr = new MediaMetadataRetriever();
//         String name = null;
//         String singer = null;
//         String album = null;
//         long duration = 0;
// 
// 
//         try {
//             mmr.setDataSource(path);
//             name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
//             singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
//             album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
//             duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
//             mmr.release();
//         } catch (Exception e) {
//             e.printStackTrace();
//             return null;
// 
//         }
//         return new MusicBean(name, singer, album, duration, path);
//     }
// 
//     @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
//     public static Bitmap getAlbumArtFromMP3File(String path) {
//         MediaMetadataRetriever mmr = new MediaMetadataRetriever();
//         try {
//             mmr.setDataSource(path);
//         } catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             return null;
//         }
//         byte[] bytes = mmr.getEmbeddedPicture();
//         if (null != bytes) {
//             return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
//         } else {
//             return mmr.getFrameAtTime();
//         }
//     }
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
// 
//     public static boolean isMusic(File file) {
//         return null!=file && file.getName().toLowerCase().endsWith(".mp3");
//     }
// 
//     public static String getAlbumArt(Context mContext, String album_id) {
//         String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
//         Cursor cur = mContext.getContentResolver().query(
//                 MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
//                 projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
//         String album_art = null;
//         if (null!=cur && cur.moveToNext()) {
//             album_art = cur.getString(0);
//             cur.close();
//         }
// 
//         return album_art;
//     }
// 
//     public static String[] getParentAndFileName(String path) {
//         if (null!=path) {
//             int lastIndex = path.lastIndexOf(File.separatorChar);
//             if (lastIndex == path.length() - 1 && lastIndex > 0) {
//                 String tmp = path.substring(0, lastIndex);
//                 lastIndex = tmp.lastIndexOf(File.separatorChar);
//             }
//             String parent = path.substring(0, lastIndex+1);
//             String name = path.substring(lastIndex+1, path.length());
//             return new String[]{parent,name};
//         }
//         return new String[]{path,path};
//     }
// }


// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


        private boolean loadImg2Cache(final ImageView imageView, String path) {
            final String mPath = path;

            if (null == mPath) {
                return false;
            }
            if (null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
                return true;
            } else {
                Bitmap bitmap = null;
                String picPath = MusicUtil.getAlbumArt(context, mPath);
                if (null!=picPath) {

                }

                if (null != bitmap) {
                    final Bitmap finalBitmap = bitmap;
                    mMainHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (mPath.equals(imageView.getTag())) {
                                imageView.setImageBitmap(finalBitmap);
                            }
                        }
                    });
                    fstCacheMap.put(mPath, bitmap);
                    return true;
                } else {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
                        bitmap = MP3Util.getAlbumArtFromMP3File(mPath);