当前位置: 首页>>代码示例>>Java>>正文


Java DiskCacheUtils类代码示例

本文整理汇总了Java中com.nostra13.universalimageloader.utils.DiskCacheUtils的典型用法代码示例。如果您正苦于以下问题:Java DiskCacheUtils类的具体用法?Java DiskCacheUtils怎么用?Java DiskCacheUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DiskCacheUtils类属于com.nostra13.universalimageloader.utils包,在下文中一共展示了DiskCacheUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readHaveCacheImages

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
public List<CacheImageBean> readHaveCacheImages(Context context) {
    fcdbHelper = new FCDBHelper(context);
    db = fcdbHelper.getWritableDatabase();
    cursor = db.query(FCDBHelper.FCIMAGETABLE, null, null, null, null, null, null);
    List<CacheImageBean> cacheImageBeans = new ArrayList<>();
    if (cursor.getCount() == 0) {
        closeDBandCursor();
        return cacheImageBeans;
    } else {
        while (cursor.moveToNext()) {
            String url = String.format(MyApplication.ImageLageUrl, cursor.getInt(0), cursor.getInt(1));
            File file = DiskCacheUtils.findInCache(url, ImageLoader.getInstance().getDiskCache());
            if (file != null && file.exists()) {
                Float aFloat = 0f;
                try{
                    aFloat = cursor.getFloat(3);
                }catch (Exception e){
                    L.e(e.toString());
                }
                cacheImageBeans.add(new CacheImageBean(url, aFloat));
            }
        }
        return cacheImageBeans;
    }
}
 
开发者ID:SwiftyWang,项目名称:FingerColoring-Android,代码行数:26,代码来源:FCDBModel.java

示例2: cleanUp

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
@SuppressLint("SetTextI18n")
private void cleanUp() {
    progressbar.setProgress(0);
    totalOriginalSize.setText("0 kb");
    totalFileSize.setText("0 kb");
    reductionPercent.setText("0 %");

    DownloadStorageSizes.clearAll();

    for (String image: imageUrls) {
        MemoryCacheUtils.removeFromCache(image, imageLoader.getMemoryCache());
        DiskCacheUtils.removeFromCache(image, imageLoader.getDiskCache());
    }

    for (ImageView imageView : imageViews) {
        if (imageView != null) {
            imageLoader.cancelDisplayTask(imageView);
            imageView.setImageResource(android.R.color.transparent);
        }
    }

    imageUrls.clear();
}
 
开发者ID:Nventify,项目名称:ImagizerAndroidExample,代码行数:24,代码来源:CompareActivity.java

示例3: setAlbumArt

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
public void setAlbumArt(File file, Bitmap artworkBitmap, Song song) throws IOException, TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException {

        artworkBitmap = Bitmap.createScaledBitmap(artworkBitmap, 500, 500, false);

        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        artworkBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);

        byte[] byteArray = stream.toByteArray();

        File artworkFile = new File(Environment.getExternalStorageDirectory() + "/artwork.jpg");

        if (!artworkFile.exists())
            artworkFile.createNewFile();

        FileOutputStream out = new FileOutputStream(artworkFile);
        artworkBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);

        Artwork artwork = Artwork.createArtworkFromFile(artworkFile);

        artwork.setBinaryData(byteArray);
        AudioFile audioFile = AudioFileIO.read(file);
        Tag tag = audioFile.getTagOrCreateAndSetDefault();


        if (tag.getFirstArtwork() != null) {
            tag.deleteArtworkField();
            tag.setField(artwork);
        } else {
            tag.addField(artwork);
        }

        Uri uri = MusicUtils.getAlbumArtUri(song._albumId);
        DiskCacheUtils.removeFromCache(uri.toString(), ImageLoader.getInstance().getDiskCache());
        String path = FileUtils.getRealPathFromURI(uri);
        new File(path).delete();
        artworkFile.delete();
    }
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:38,代码来源:AlbumsArtDownloadService.java

示例4: getCachePath

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
@Override
public String getCachePath(String url) {
	try {
		if(DiskCacheUtils.findInCache(url, ImageLoader.getInstance().getDiskCache()) == null){
			return "";
		}else{
			return DiskCacheUtils.findInCache(url, ImageLoader.getInstance().getDiskCache()).getAbsolutePath();
		}
		//return ImageLoader.getInstance().getDiskCache().get(url).getAbsolutePath();
	} catch (Exception e) {
		e.printStackTrace();
		return "";
	}
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:15,代码来源:ImageLoaderUseUIL.java

示例5: onLoadingComplete

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    if (view == null) return;

    Object tag = view.getTag(R.id.tag_image);
    if (enableDebugLog) FLog.d("tag: %s", tag);

    if (tag != null && tag instanceof String) {
        String actualUri = tag.toString();

        File pngFile = AssistUtil.getCopiedFile(context, actualUri);

        if (pngFile == null) {
            if (enableDebugLog) FLog.w("Can't locate the file!!! %s", actualUri);

        } else if (pngFile.exists()) {
            boolean isApng = AssistUtil.isApng(pngFile);

            if (isApng) {
                if (enableDebugLog) FLog.d("Setup apng drawable");
                ApngDrawable drawable = new ApngDrawable(context, loadedImage, Uri.fromFile(pngFile));
                ((ImageView) view).setImageDrawable(drawable);
            } else {
                ((ImageView) view).setImageBitmap(loadedImage);
            }

        } else {
            if (enableDebugLog) FLog.d("Clear cache and reload");
            MemoryCacheUtils.removeFromCache(actualUri, ApngImageLoader.getInstance().getMemoryCache());
            DiskCacheUtils.removeFromCache(actualUri, ApngImageLoader.getInstance().getDiskCache());

            ApngImageLoader.getInstance().displayImage(actualUri, (ImageView) view, this);
        }
    }

    if (shouldForward()) callback.onLoadFinish(true, imageUri, view);
}
 
开发者ID:sahasbhop,项目名称:apng-view,代码行数:38,代码来源:ApngImageLoadingListener.java

示例6: getDiscCache

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
public File getDiscCache(String s)
{
    return DiskCacheUtils.findInCache(s, b.getDiscCache());
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:5,代码来源:BraceletImageLoader.java

示例7: removeImageCache

import com.nostra13.universalimageloader.utils.DiskCacheUtils; //导入依赖的package包/类
public void removeImageCache(String s)
{
    MemoryCacheUtils.removeFromCache(s, b.getMemoryCache());
    DiskCacheUtils.removeFromCache(s, b.getDiscCache());
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:6,代码来源:BraceletImageLoader.java


注:本文中的com.nostra13.universalimageloader.utils.DiskCacheUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。