Java 类com.nostra13.universalimageloader.core.assist.MemoryCacheUtil 实例源码

项目:buddycloud-android    文件:ChannelDetailActivity.java   
private ImageView loadAvatar(final String channelJid, boolean skipCache) {
    ImageView avatarView = (ImageView) findViewById(R.id.bcProfilePic);
    DisplayImageOptions dio = new DisplayImageOptions.Builder()
            .cloneFrom(ImageHelper.defaultImageOptions())
            .showImageOnFail(R.drawable.ic_avatar)
            .showImageOnLoading(R.drawable.ic_avatar)
            .preProcessor(ImageHelper.createRoundProcessor(16, false, -1))
            .resetViewBeforeLoading(true)
            .build();

    String avatarURL = AvatarUtils.avatarURL(this, channelJid);
    if (skipCache) {
        DiscCacheUtil.removeFromCache(avatarURL, ImageLoader.getInstance()
                .getDiscCache());
        MemoryCacheUtil.removeFromCache(avatarURL, ImageLoader
                .getInstance().getMemoryCache());
    }

    ImageLoader.getInstance().displayImage(avatarURL, avatarView, dio);

    return avatarView;
}
项目:morse    文件:ImageLoaderConfiguration.java   
private void initEmptyFieldsWithDefaultValues() {
    if (taskExecutor == null) {
        taskExecutor = DefaultConfigurationFactory
                .createExecutor(threadPoolSize, threadPriority, tasksProcessingType);
    } else {
        customExecutor = true;
    }
    if (taskExecutorForCachedImages == null) {
        taskExecutorForCachedImages = DefaultConfigurationFactory
                .createExecutor(threadPoolSize, threadPriority, tasksProcessingType);
    } else {
        customExecutorForCachedImages = true;
    }
    if (discCache == null) {
        if (discCacheFileNameGenerator == null) {
            discCacheFileNameGenerator = DefaultConfigurationFactory.createFileNameGenerator();
        }
        discCache = DefaultConfigurationFactory
                .createDiscCache(context, discCacheFileNameGenerator, discCacheSize, discCacheFileCount);
    }
    if (memoryCache == null) {
        memoryCache = DefaultConfigurationFactory.createMemoryCache(memoryCacheSize);
    }
    if (denyCacheImageMultipleSizesInMemory) {
        memoryCache = new FuzzyKeyMemoryCache<String, Bitmap>(memoryCache, MemoryCacheUtil
                .createFuzzyKeyComparator());
    }
    if (downloader == null) {
        downloader = DefaultConfigurationFactory.createImageDownloader(context);
    }
    if (decoder == null) {
        decoder = DefaultConfigurationFactory.createImageDecoder(writeLogs);
    }
    if (defaultDisplayImageOptions == null) {
        defaultDisplayImageOptions = DisplayImageOptions.createSimple();
    }
}
项目:kaorisan    文件:DetailAdapter.java   
@SuppressLint("SimpleDateFormat") 
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = (LinearLayout) inflater.inflate(rowID, null);
    }

    // set value to item
    DetailObj obj=(DetailObj)getItem(position);

    TextView title=(TextView)convertView.findViewById(R.id.detail_title);
    title.setText(obj.getTitle());

    //parse String -> date
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       Calendar c=Calendar.getInstance();
       try {
           c.setTime(format.parse(obj.getEmpire()));
       } catch (Exception e) {
        Log.e(mContext.getPackageName(), "can't parse String -> Date");
       }
       Log.d(mContext.getPackageName(),"parse result:"+ c.get(Calendar.HOUR_OF_DAY)+"h"+c.get(Calendar.MINUTE)+" Ngày "+c.get(Calendar.DAY_OF_MONTH)+"/"+c.get(Calendar.MONTH)+"/"+c.get(Calendar.YEAR));
    TextView expireDate=(TextView)convertView.findViewById(R.id.detail_empire);
    expireDate.setText("Đến hết: "+c.get(Calendar.HOUR_OF_DAY)+"h"+c.get(Calendar.MINUTE)+" Ngày "+c.get(Calendar.DAY_OF_MONTH)+"/"+c.get(Calendar.MONTH)+"/"+c.get(Calendar.YEAR));

    ImageView icon=(ImageView)convertView.findViewById(R.id.detail_iconDistributor);
    List<Bitmap> lbm=MemoryCacheUtil.findCachedBitmapsForImageUri(mIconPathDistributor, ImageLoader.getInstance().getMemoryCache());
    icon.setImageBitmap(lbm.get(0));

    return convertView;
}
项目:juahya    文件:DefaultConfigurationFactory.java   
/** Creates default implementation of {@link MemoryCacheAware} depends on incoming parameters */
public static MemoryCacheAware<String, Bitmap> createMemoryCache(int memoryCacheSize, boolean denyCacheImageMultipleSizesInMemory) {
    MemoryCacheAware<String, Bitmap> memoryCache = new UsingFreqLimitedMemoryCache(memoryCacheSize);
    if (denyCacheImageMultipleSizesInMemory) {
        memoryCache = new FuzzyKeyMemoryCache<String, Bitmap>(memoryCache, MemoryCacheUtil.createFuzzyKeyComparator());
    }
    return memoryCache;
}
项目:juahya    文件:ImageLoadingInfo.java   
public ImageLoadingInfo(String uri, ImageView imageView, ImageSize targetSize, DisplayImageOptions options, ImageLoadingListener listener, ReentrantLock loadFromUriLock) {
    this.uri = uri;
    this.imageView = imageView;
    this.targetSize = targetSize;
    this.options = options;
    this.listener = listener;
    this.loadFromUriLock = loadFromUriLock;
    memoryCacheKey = MemoryCacheUtil.generateKey(uri, targetSize);
}
项目:kaorisan    文件:LoadFooter.java   
public void loadCache() {
    List<Bitmap> lbm=MemoryCacheUtil.findCachedBitmapsForImageUri(spref.getString(BANNER_LINK_CACHE, ""), ImageLoader.getInstance().getMemoryCache());
    image.setImageBitmap(lbm.get(0));
}
项目:TNTU-APP    文件:AnimateFirstDisplayListener.java   
@Override
    public void onLoadingStarted(String url, View view) {
        List<String> memCache = MemoryCacheUtil.
                findCacheKeysForImageUri(url, ImageLoader.getInstance().getMemoryCache());
        cacheFound = !memCache.isEmpty();
        if (!cacheFound) {
            File discCache = DiscCacheUtil.
                    findInCache(url, ImageLoader.getInstance().getDiscCache());
            if (discCache != null) {
                cacheFound = discCache.exists();
            }
        }
    }