亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? musicutils.java

?? Android平臺上的media player, iPhone風格
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
            }        }        return d;    }    // Get album art for specified album. This method will not try to    // fall back to getting artwork directly from the file, nor will    // it attempt to repair the database.    private static Bitmap getArtworkQuick(Context context, int album_id, int w, int h) {        // NOTE: There is in fact a 1 pixel frame in the ImageView used to        // display this drawable. Take it into account now, so we don't have to        // scale later.        w -= 2;        h -= 2;        ContentResolver res = context.getContentResolver();        Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);        if (uri != null) {            ParcelFileDescriptor fd = null;            try {                fd = res.openFileDescriptor(uri, "r");                int sampleSize = 1;                                // Compute the closest power-of-two scale factor                 // and pass that to sBitmapOptionsCache.inSampleSize, which will                // result in faster decoding and better quality                sBitmapOptionsCache.inJustDecodeBounds = true;                BitmapFactory.decodeFileDescriptor(                        fd.getFileDescriptor(), null, sBitmapOptionsCache);                int nextWidth = sBitmapOptionsCache.outWidth >> 1;                int nextHeight = sBitmapOptionsCache.outHeight >> 1;                while (nextWidth>w && nextHeight>h) {                    sampleSize <<= 1;                    nextWidth >>= 1;                    nextHeight >>= 1;                }                sBitmapOptionsCache.inSampleSize = sampleSize;                sBitmapOptionsCache.inJustDecodeBounds = false;                Bitmap b = BitmapFactory.decodeFileDescriptor(                        fd.getFileDescriptor(), null, sBitmapOptionsCache);                if (b != null) {                    // finally rescale to exactly the size we need                    if (sBitmapOptionsCache.outWidth != w || sBitmapOptionsCache.outHeight != h) {                        Bitmap tmp = Bitmap.createScaledBitmap(b, w, h, true);                        b.recycle();                        b = tmp;                    }                }                                return b;            } catch (FileNotFoundException e) {            } finally {                try {                    if (fd != null)                        fd.close();                } catch (IOException e) {                }            }        }        return null;    }        // Get album art for specified album. You should not pass in the album id    // for the "unknown" album here (use -1 instead)    public static Bitmap getArtwork(Context context, int album_id) {        if (album_id < 0) {            // This is something that is not in the database, so get the album art directly            // from the file.            Bitmap bm = getArtworkFromFile(context, null, -1);            if (bm != null) {                return bm;            }            return getDefaultArtwork(context);        }        ContentResolver res = context.getContentResolver();        Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);        if (uri != null) {            InputStream in = null;            try {                in = res.openInputStream(uri);                return BitmapFactory.decodeStream(in, null, sBitmapOptions);            } catch (FileNotFoundException ex) {                // The album art thumbnail does not actually exist. Maybe the user deleted it, or                // maybe it never existed to begin with.                Bitmap bm = getArtworkFromFile(context, null, album_id);                if (bm != null) {                    // Put the newly found artwork in the database.                    // Note that this shouldn't be done for the "unknown" album,                    // but if this method is called correctly, that won't happen.                                        // first write it somewhere                    String file = Environment.getExternalStorageDirectory()                        + "/albumthumbs/" + String.valueOf(System.currentTimeMillis());                    if (ensureFileExists(file)) {                        try {                            OutputStream outstream = new FileOutputStream(file);                            if (bm.getConfig() == null) {                                bm = bm.copy(Bitmap.Config.RGB_565, false);                                if (bm == null) {                                    return getDefaultArtwork(context);                                }                            }                            boolean success = bm.compress(Bitmap.CompressFormat.JPEG, 75, outstream);                            outstream.close();                            if (success) {                                ContentValues values = new ContentValues();                                values.put("album_id", album_id);                                values.put("_data", file);                                Uri newuri = res.insert(sArtworkUri, values);                                if (newuri == null) {                                    // Failed to insert in to the database. The most likely                                    // cause of this is that the item already existed in the                                    // database, and the most likely cause of that is that                                    // the album was scanned before, but the user deleted the                                    // album art from the sd card.                                    // We can ignore that case here, since the media provider                                    // will regenerate the album art for those entries when                                    // it detects this.                                    success = false;                                }                            }                            if (!success) {                                File f = new File(file);                                f.delete();                            }                        } catch (FileNotFoundException e) {                            Log.e(TAG, "error creating file", e);                        } catch (IOException e) {                            Log.e(TAG, "error creating file", e);                        }                    }                } else {                    bm = getDefaultArtwork(context);                }                return bm;            } finally {                try {                    if (in != null) {                        in.close();                    }                } catch (IOException ex) {                }            }        }                return null;    }    // copied from MediaProvider    private static boolean ensureFileExists(String path) {        File file = new File(path);        if (file.exists()) {            return true;        } else {            // we will not attempt to create the first directory in the path            // (for example, do not create /sdcard if the SD card is not mounted)            int secondSlash = path.indexOf('/', 1);            if (secondSlash < 1) return false;            String directoryPath = path.substring(0, secondSlash);            File directory = new File(directoryPath);            if (!directory.exists())                return false;            file.getParentFile().mkdirs();            try {                return file.createNewFile();            } catch(IOException ioe) {                Log.e(TAG, "File creation failed", ioe);            }            return false;        }    }        // get album art for specified file    private static final String sExternalMediaUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.toString();    private static Bitmap getArtworkFromFile(Context context, Uri uri, int albumid) {        Bitmap bm = null;        byte [] art = null;        String path = null;        if (sArtId == albumid) {            //Log.i("@@@@@@ ", "reusing cached data", new Exception());            if (mCachedBit != null) {                return mCachedBit;            }            art = mCachedArt;        } else {            // try reading embedded artwork            if (uri == null) {                try {                    int curalbum = sService.getAlbumId();                    if (curalbum == albumid || albumid < 0) {                        path = sService.getPath();                        if (path != null) {                            uri = Uri.parse(path);                        }                    }                } catch (RemoteException ex) {                }            }            if (uri == null) {                if (albumid >= 0) {                    Cursor c = query(context,MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,                            new String[] { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ALBUM },                            MediaStore.Audio.Media.ALBUM_ID + "=?", new String [] {String.valueOf(albumid)},                            null);                    if (c != null) {                        c.moveToFirst();                        if (!c.isAfterLast()) {                            int trackid = c.getInt(0);                            uri = ContentUris.withAppendedId(                                    MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, trackid);                        }                        if (c.getString(1).equals(MediaFile.UNKNOWN_STRING)) {                            albumid = -1;                        }                        c.close();                    }                }            }            if (uri != null) {//                MediaScanner scanner = new MediaScanner(context);                ParcelFileDescriptor pfd = null;                try {                    pfd = context.getContentResolver().openFileDescriptor(uri, "r");                    if (pfd != null) {                        FileDescriptor fd = pfd.getFileDescriptor();//                        art = scanner.extractAlbumArt(fd);                    }                } catch (IOException ex) {                } catch (SecurityException ex) {                } finally {                    try {                        if (pfd != null) {                            pfd.close();                        }                    } catch (IOException ex) {                    }                }            }        }        // if no embedded art exists, look for AlbumArt.jpg in same directory as the media file        if (art == null && path != null) {            if (path.startsWith(sExternalMediaUri)) {                // get the real path                Cursor c = query(context,Uri.parse(path),                        new String[] { MediaStore.Audio.Media.DATA},                        null, null, null);                if (c != null) {                    c.moveToFirst();                    if (!c.isAfterLast()) {                        path = c.getString(0);                    }                    c.close();                }            }            int lastSlash = path.lastIndexOf('/');            if (lastSlash > 0) {                String artPath = path.substring(0, lastSlash + 1) + "AlbumArt.jpg";                File file = new File(artPath);                if (file.exists()) {                    art = new byte[(int)file.length()];                    FileInputStream stream = null;                    try {                        stream = new FileInputStream(file);                        stream.read(art);                    } catch (IOException ex) {                        art = null;                    } finally {                        try {                            if (stream != null) {                                stream.close();                            }                        } catch (IOException ex) {                        }                    }                } else {                    // TODO: try getting album art from the web                }            }        }                if (art != null) {            try {                // get the size of the bitmap                BitmapFactory.Options opts = new BitmapFactory.Options();                opts.inJustDecodeBounds = true;                opts.inSampleSize = 1;                BitmapFactory.decodeByteArray(art, 0, art.length, opts);                                // request a reasonably sized output image                // TODO: don't hardcode the size                while (opts.outHeight > 320 || opts.outWidth > 320) {                    opts.outHeight /= 2;                    opts.outWidth /= 2;                    opts.inSampleSize *= 2;                }                                // get the image for real now                opts.inJustDecodeBounds = false;                bm = BitmapFactory.decodeByteArray(art, 0, art.length, opts);                if (albumid != -1) {                    sArtId = albumid;                }                mCachedArt = art;                mCachedBit = bm;            } catch (Exception e) {            }        }        return bm;    }        private static Bitmap getDefaultArtwork(Context context) {        BitmapFactory.Options opts = new BitmapFactory.Options();        opts.inPreferredConfig = Bitmap.Config.ARGB_8888;        return BitmapFactory.decodeStream(                context.getResources().openRawResource(R.drawable.albumart_mp_unknown), null, opts);    }        static int getIntPref(Context context, String name, int def) {        SharedPreferences prefs =            context.getSharedPreferences("com.android.imusic", Context.MODE_PRIVATE);        return prefs.getInt(name, def);    }        static void setIntPref(Context context, String name, int value) {        SharedPreferences prefs =            context.getSharedPreferences("com.android.imusic", Context.MODE_PRIVATE);        Editor ed = prefs.edit();        ed.putInt(name, value);        ed.commit();    }    static void setRingtone(Context context, long id) {        ContentResolver resolver = context.getContentResolver();        // Set the flag in the database to mark this as a ringtone        Uri ringUri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id);        try {            ContentValues values = new ContentValues(2);            values.put(MediaStore.Audio.Media.IS_RINGTONE, "1");            values.put(MediaStore.Audio.Media.IS_ALARM, "1");            resolver.update(ringUri, values, null, null);        } catch (UnsupportedOperationException ex) {            // most likely the card just got unmounted            Log.e(TAG, "couldn't set ringtone flag for id " + id);            return;        }        String[] cols = new String[] {                MediaStore.Audio.Media._ID,                MediaStore.Audio.Media.DATA,                MediaStore.Audio.Media.TITLE        };        String where = MediaStore.Audio.Media._ID + "=" + id;        Cursor cursor = query(context, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,                cols, where , null, null);        try {            if (cursor != null && cursor.getCount() == 1) {                // Set the system setting to make this the current ringtone                cursor.moveToFirst();                Settings.System.putString(resolver, Settings.System.RINGTONE, ringUri.toString());                String message = context.getString(R.string.ringtone_set, cursor.getString(2));                Toast.makeText(context, message, Toast.LENGTH_SHORT).show();            }        } finally {            if (cursor != null) {                cursor.close();            }        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品18久久久久久vr | 色一区在线观看| 日韩一区二区三区三四区视频在线观看 | 成人激情综合网站| 日韩欧美的一区二区| 一区二区三区在线观看国产| 国产精品一区二区久激情瑜伽| 欧美日韩黄色一区二区| 亚洲色图视频免费播放| 国产精华液一区二区三区| 欧美一区二区三级| 亚洲日本在线a| 丁香桃色午夜亚洲一区二区三区| 日韩一二三区不卡| 日韩在线观看一区二区| 欧美午夜精品一区二区三区 | 7777女厕盗摄久久久| 一区二区三区四区不卡在线| aaa亚洲精品| 欧美激情一区二区三区四区 | 亚洲女厕所小便bbb| 丁香婷婷综合激情五月色| 久久久综合九色合综国产精品| 美国毛片一区二区| 欧美一级精品大片| 日韩精品乱码av一区二区| 欧美性生活影院| 一区二区久久久| 色综合久久久网| 一区二区三区av电影| 一本大道久久精品懂色aⅴ | 欧美videossexotv100| 婷婷中文字幕综合| 欧美丰满嫩嫩电影| 五月天视频一区| 51精品久久久久久久蜜臀| 五月婷婷久久综合| 欧美福利视频一区| 人人狠狠综合久久亚洲| 91精品国产全国免费观看| 日本不卡一区二区三区高清视频| 欧美日韩的一区二区| 爽好多水快深点欧美视频| 在线播放亚洲一区| 麻豆国产精品一区二区三区| 日韩一级片网站| 极品少妇一区二区| 国产无人区一区二区三区| 国产成人欧美日韩在线电影 | 欧美日韩一级视频| 午夜视频一区二区三区| 91精品视频网| 激情久久五月天| 国产欧美精品一区二区色综合| 懂色av一区二区三区蜜臀| 综合久久久久久| 欧美丝袜第三区| 美国毛片一区二区三区| 久久精品亚洲精品国产欧美kt∨| 国产999精品久久| 亚洲精品久久久久久国产精华液| 欧美性xxxxxxxx| 久久精品国产成人一区二区三区| 久久精品亚洲乱码伦伦中文| av在线一区二区三区| 亚洲一区二区三区四区五区中文| 91精品国产高清一区二区三区蜜臀 | 无码av免费一区二区三区试看| 欧美一区二区三区视频免费| 狠狠色狠狠色综合| 中文字幕制服丝袜成人av | 色婷婷亚洲精品| 五月天精品一区二区三区| 精品美女被调教视频大全网站| 国产91丝袜在线观看| 亚洲欧美电影院| 日韩亚洲欧美中文三级| 成人不卡免费av| 亚洲成人动漫av| 久久精品一区蜜桃臀影院| 99r国产精品| 日本网站在线观看一区二区三区| 久久久久97国产精华液好用吗| 色噜噜狠狠色综合中国| 奇米一区二区三区av| 国产精品欧美极品| 6080日韩午夜伦伦午夜伦| 成人性生交大合| 天堂一区二区在线免费观看| 欧美激情资源网| 欧美精品123区| 成人国产亚洲欧美成人综合网| 亚洲成a人v欧美综合天堂下载| 久久亚洲捆绑美女| 欧美在线观看禁18| 国产精品亚洲成人| 亚洲午夜免费福利视频| 国产性做久久久久久| 欧美日韩高清影院| 欧美一区二区免费观在线| 成人午夜激情片| 日本网站在线观看一区二区三区| 最新高清无码专区| 精品少妇一区二区三区在线播放| 91麻豆免费观看| 久久精品国产第一区二区三区| 一区二区三区在线观看国产| 久久久久久久av麻豆果冻| 欧美日韩免费视频| av毛片久久久久**hd| 国内精品写真在线观看| 午夜精品一区二区三区免费视频 | 日韩一区二区三区免费观看| av亚洲产国偷v产偷v自拍| 青草国产精品久久久久久| 一区二区三区在线免费播放| 日本一区二区不卡视频| 日韩一区二区三区精品视频| 91成人在线免费观看| 粉嫩aⅴ一区二区三区四区五区| 日本麻豆一区二区三区视频| 亚洲精品免费在线| 国产精品久久久久7777按摩| 精品国产一二三| 欧美一区二区性放荡片| 欧美亚洲动漫另类| jiyouzz国产精品久久| 国产一区二区精品在线观看| 日韩高清不卡一区| 亚洲大片免费看| 亚洲精品综合在线| 日韩美女啊v在线免费观看| 国产片一区二区| 久久综合九色综合欧美亚洲| 337p亚洲精品色噜噜狠狠| 欧美亚洲动漫精品| 91激情在线视频| 91免费看`日韩一区二区| 成人午夜视频福利| 国产成人精品三级| 国产精品一区三区| 经典三级一区二区| 韩国欧美一区二区| 国内精品久久久久影院色| 捆绑调教美女网站视频一区| 日本不卡一区二区| 日韩精品一级二级| 日本va欧美va瓶| 免费看日韩a级影片| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产精品毛片高清在线完整版| 久久亚洲综合色一区二区三区| 精品国产一区二区三区四区四 | 在线观看免费一区| 色网综合在线观看| 色婷婷综合中文久久一本| 色综合久久综合网97色综合| 91久久精品网| 欧美色偷偷大香| 欧美日韩精品综合在线| 777a∨成人精品桃花网| 日韩精品一区二区三区视频播放 | 色综合天天综合| 日本高清不卡一区| 欧美性一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 日本视频中文字幕一区二区三区| 日本午夜精品一区二区三区电影 | 亚洲成a人v欧美综合天堂| 午夜视频在线观看一区| 日本成人在线电影网| 久久国内精品自在自线400部| 国产一区二区调教| 懂色av中文一区二区三区| 91首页免费视频| 欧美亚洲另类激情小说| 欧美一区二区三区人| 久久一区二区三区四区| 中文字幕一区二区5566日韩| 亚洲激情在线激情| 性做久久久久久免费观看欧美| 日韩不卡免费视频| 国内外精品视频| 成人av电影在线网| 欧美三级电影一区| 精品女同一区二区| 国产精品久久久久久久久晋中 | av不卡免费电影| 欧美揉bbbbb揉bbbbb| 欧美成人精品3d动漫h| 日本一区二区不卡视频| 亚洲资源中文字幕| 久久99久久精品| av一区二区三区四区| 在线成人免费视频| 亚洲国产精品黑人久久久| 亚洲最色的网站| 久久99九九99精品| 97久久久精品综合88久久| 777亚洲妇女|