Java 类com.nostra13.universalimageloader.core.ImageLoader 实例源码

项目:GitHub    文件:CommonFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_common, null);
    DragLayout dragLayout = (DragLayout) rootView.findViewById(R.id.drag_layout);
    imageView = (ImageView) dragLayout.findViewById(R.id.image);
    ImageLoader.getInstance().displayImage(imageUrl, imageView);
    address1 = dragLayout.findViewById(R.id.address1);
    address2 = dragLayout.findViewById(R.id.address2);
    address3 = dragLayout.findViewById(R.id.address3);
    address4 = dragLayout.findViewById(R.id.address4);
    address5 = dragLayout.findViewById(R.id.address5);
    ratingBar = (RatingBar) dragLayout.findViewById(R.id.rating);

    head1 = dragLayout.findViewById(R.id.head1);
    head2 = dragLayout.findViewById(R.id.head2);
    head3 = dragLayout.findViewById(R.id.head3);
    head4 = dragLayout.findViewById(R.id.head4);

    dragLayout.setGotoDetailListener(this);
    return rootView;
}
项目:OpenEyesReading-android    文件:DailyPicksAdapter.java   
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
    final IHistoryDailyPicks data = this.datas.get(position);
    if (data != null) {
        holder.titleTv.setText(data.getTitle());
        holder.contentTv.setText(data.getDescribe());
        holder.timeTv.setText(data.getTime());
        holder.discussTv.setText(data.getDiscuss());
        ImageLoader.getInstance().displayImage(data.getImgHref(), holder.picIv);
        holder.rootView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.itemClicked(position, data.getTitle(), data.getHref());
            }
        });
    }
}
项目:GitHub    文件:SampleUilFactory.java   
public static ImageLoader getImageLoader(Context context) {
  if (sImageLoader == null) {
    DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
        .showImageOnLoading(Drawables.sPlaceholderDrawable)
        .showImageOnFail(Drawables.sErrorDrawable)
        .cacheInMemory(true)
        .cacheOnDisk(true)
        .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
        .defaultDisplayImageOptions(displayImageOptions)
        .diskCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
        .memoryCacheSize(ConfigConstants.MAX_MEMORY_CACHE_SIZE)
        .build();
    sImageLoader = ImageLoader.getInstance();
    sImageLoader.init(config);
  }
  return sImageLoader;
}
项目:GitHub    文件:UILApplication.java   
public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them,
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
项目:MontageCam    文件:BaseActivity.java   
/**
 * 初始化图片载入框架
 */
private void initImageLoader() {
    File cacheDir = StorageUtils.getCacheDirectory(this);
    int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
    // System.out.println("dsa-->"+MAXMEMONRY+"   "+(MAXMEMONRY/5));//.memoryCache(new
    // LruMemoryCache(50 * 1024 * 1024))
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this).memoryCacheExtraOptions(480, 800).defaultDisplayImageOptions(defaultOptions)
            .diskCacheExtraOptions(480, 800, null).threadPoolSize(3)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
            .diskCache(new UnlimitedDiskCache(cacheDir))
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .imageDecoder(new BaseImageDecoder(false)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()).build();

    ImageLoader.getInstance().init(config);
}
项目:wallpaperboard    文件:WallpaperBoardPreviewActivity.java   
@Override
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState,
                                SlidingUpPanelLayout.PanelState newState) {
    File file = ImageLoader.getInstance().getDiskCache().get(mWallpaper.getUrl());
    if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED &&
            mTooltip == null
            && Preferences.get(this).isShowWallpaperTooltip() &&
            !file.exists() &&
            !Preferences.get(this).isTimeToShowWallpaperPreviewIntro() &&
            !Preferences.get(this).isHighQualityPreviewEnabled()) {
        mTooltip = Tooltip.Builder(this)
                .to(mMenuPreview)
                .content(R.string.wallpaper_tooltip_preview)
                .desc(R.string.wallpaper_tooltip_preview_icon_tap)
                .descIcon(R.drawable.ic_toolbar_preview_full)
                .visibleDontShowAgain(true)
                .cancelable(false)
                .buttonCallback(tooltip -> {
                    Preferences.get(this).setShowWallpaperTooltip(!tooltip.getCheckboxState());
                    tooltip.dismiss();
                })
                .build();
        mTooltip.show();
    }
}
项目:Wings2K16    文件:GalleryActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {


    switch (item.getItemId()) {
        case android.R.id.home:
            this.finish();
            return true;
        case R.id.item_clear_memory_cache:
            ImageLoader.getInstance().clearMemoryCache();
            return true;
        case R.id.item_clear_disc_cache:
            ImageLoader.getInstance().clearDiskCache();
            return true;
        default:
            return false;
    }

}
项目:GifImageLoader    文件:ImageListFragment.java   
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView;
    final ViewHolder holder;
    if (convertView == null) {
        view = inflater.inflate(R.layout.item_list_image, parent, false);
        holder = new ViewHolder();
        holder.text = (TextView) view.findViewById(R.id.text);
        holder.image = (ImageView) view.findViewById(R.id.image);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    holder.text.setText("Item " + (position + 1));

    ImageLoader.getInstance().displayImage(IMAGE_URLS[position], holder.image, options, animateFirstListener);

    return view;
}
项目:mobile-store    文件:ScreenShotsActivity.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {

    DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .imageScaleType(ImageScaleType.NONE)
            .showImageOnLoading(R.drawable.screenshot_placeholder)
            .showImageForEmptyUri(R.drawable.screenshot_placeholder)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    View rootView = inflater.inflate(R.layout.activity_screenshots_page, container, false);

    ImageView screenshotView = (ImageView) rootView.findViewById(R.id.screenshot);
    ImageLoader.getInstance().displayImage(screenshotUrl, screenshotView, displayImageOptions);

    return rootView;
}
项目:ListVideoPlayer    文件:MainActivity.java   
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = null;
    if(convertView == null) {
        convertView = View.inflate(MainActivity.this,R.layout.list_item_layout,null);
        viewHolder = new ViewHolder(convertView);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.button.setText(position + "");
    viewHolder.button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            VideoPlayerManager.getInstance().listVideoPlayer(listView, R.id.container, position, mDatas.get(position), position + "", mThumbs.get(position), ImageLoader.getInstance());
        }
    });
    return convertView;
}
项目:RoadLab-Pro    文件:RAApplication.java   
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
    .threadPoolSize(5)
    .threadPriority(Thread.NORM_PRIORITY - 2)
    .denyCacheImageMultipleSizesInMemory()
    .memoryCache(new LruMemoryCache(2 * 1024))
    .memoryCacheSize(2 * 1024)
    .defaultDisplayImageOptions(new DisplayImageOptions.Builder()
    .showImageForEmptyUri(R.drawable.no_photo_group)
    .showImageOnFail(R.drawable.no_photo_group)
    .resetViewBeforeLoading(true)
    .displayer(new FadeInBitmapDisplayer(300)).build())
    .tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
    com.nostra13.universalimageloader.utils.L.writeLogs(false);
}
项目:rx-twitter-stream-android    文件:RxTwitterApplication.java   
public void initImageLoader() {
        File cacheDir = StorageUtils.getCacheDirectory(this);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiskCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
项目:Hello-Music-droid    文件:PlayingQueueAdapter.java   
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
    Song localItem = arraylist.get(i);

    itemHolder.title.setText(localItem.title);
    itemHolder.artist.setText(localItem.artistName);

    if (MusicPlayer.getCurrentAudioId() == localItem.id) {
        itemHolder.title.setTextColor(Config.accentColor(mContext, ateKey));
        if (MusicPlayer.isPlaying()) {
            itemHolder.visualizer.setColor(Config.accentColor(mContext, ateKey));
            itemHolder.visualizer.setVisibility(View.VISIBLE);
        }
    } else {
        itemHolder.title.setTextColor(Config.textColorPrimary(mContext, ateKey));
        itemHolder.visualizer.setVisibility(View.GONE);
    }
    ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build());
    setOnPopupMenuListener(itemHolder, i);
}
项目:Hello-Music-droid    文件:ArtistAlbumAdapter.java   
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {

    Album localItem = arraylist.get(i);

    itemHolder.title.setText(localItem.title);
    String songCount = TimberUtils.makeLabel(mContext, R.plurals.Nsongs, localItem.songCount);
    itemHolder.details.setText(songCount);

    ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.id).toString(), itemHolder.albumArt,
            new DisplayImageOptions.Builder().cacheInMemory(true)
                    .showImageOnFail(R.drawable.ic_empty_music2)
                    .resetViewBeforeLoading(true)
                    .build());

    if (TimberUtils.isLollipop())
        itemHolder.albumArt.setTransitionName("transition_album_art" + i);

}
项目:FreeStreams-TVLauncher    文件:ClientApplication.java   
/**
 * init UIL ImageLoader
 */
public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you
    // may tune some of them,
    // or you can create default configuration by
    // ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            context).threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .writeDebugLogs() // Remove for release app
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
项目:musicplayer    文件:Recommend.java   
private void initImageLoader() {
    File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
            .getOwnCacheDirectory(getActivity(),
                    IMAGE_CACHE_PATH);

    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true).cacheOnDisc(true).build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getActivity()).defaultDisplayImageOptions(defaultOptions)
            .memoryCache(new LruMemoryCache(12 * 1024 * 1024))
            .memoryCacheSize(12 * 1024 * 1024)
            .discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
            .discCache(new UnlimitedDiscCache(cacheDir))
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.LIFO).build();

    ImageLoader.getInstance().init(config);
}
项目:musicplayer    文件:BaseApplication.java   
public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them,
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.discCacheFileNameGenerator(new Md5FileNameGenerator());
    config.discCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());

}
项目:72GGames_Demo    文件:ViewHolder.java   
/**
 * 为ImageView设置图片
 *
 * @param viewId
 * @return
 */
public ViewHolder setImageByUrl(int viewId, String url)
{
    ImageView iv = getView(viewId);
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.mipmap.ic_launcher)
            .showImageOnFail(R.mipmap.ic_launcher)
            // 设置图片质量
            .bitmapConfig(Bitmap.Config.RGB_565)
            // 设置内存缓存
            .cacheInMemory(true)
            // 设置磁盘缓存
            .cacheOnDisk(true)
            // 设置图片特效
            .displayer(new FadeInBitmapDisplayer(300)).build();
    ImageLoader.getInstance().displayImage(url,iv,
            ImageLoaderUtil.getFadeInOption(200,true,true,true));
    return this;
}
项目:Rey-MusicPlayer    文件:Id3TagEditorActivity.java   
public void updateFetchedDetails(String artUrl,
                                 String trackName,
                                 String albumName,
                                 String artistName,
                                 String primaryGenreName,
                                 String releaseDate,
                                 int trackNumber,
                                 int trackCount) {
    artWorkUrl = artUrl;
    ImageLoader.getInstance().displayImage(artUrl, mAlbumArtImage);
    albumArtistEdited = true;
    mTitleEditText.setText(trackName);
    mAlbumEditText.setText(albumName);
    mArtistEditText.setText(artistName);
    mGenreEditText.setText(primaryGenreName);
    mYearEditText.setText(releaseDate.substring(0, 10));
    mTrackEditText.setText("" + trackNumber);
    mTotalTrackEditText.setText("" + trackCount);

}
项目:boohee_v5.6    文件:CustomSportListAdapter.java   
public View getItemView(int position, View convertView, ViewHolder holder) {
    CustomSport customSport = (CustomSport) getItem(position);
    if (customSport != null) {
        ImageView civ_title = (ImageView) holder.getView(R.id.civ_icon);
        TextView tv_calory = (TextView) holder.getView(R.id.tv_calory);
        TextView tv_unit = (TextView) holder.getView(R.id.tv_unit);
        ImageView iv_health_light = (ImageView) holder.getView(R.id.iv_light);
        ((TextView) holder.getView(R.id.tv_name)).setText(customSport.activity_name);
        ImageLoader.getInstance().displayImage("", civ_title, ImageLoaderOptions.global((int)
                R.drawable.aa5));
        if (TextUtils.isEmpty(customSport.calory)) {
            tv_calory.setText("0");
        } else {
            tv_calory.setText(Math.round(Float.parseFloat(customSport.calory)) + "");
        }
        tv_unit.setText(String.format(" 千卡/%1$s%2$s", new Object[]{customSport.amount,
                customSport.unit_name}));
        iv_health_light.setBackgroundResource(R.drawable.a9a);
        iv_health_light.setOnClickListener(new DelListener(position));
    }
    return convertView;
}
项目:xlight_android_native    文件:MainMenuFragment.java   
@Override
public void onResume() {
    super.onResume();
    if (UserUtils.isLogin(getActivity())) {
        LoginResult userInfo = UserUtils.getUserInfo(getActivity());
        btnLogin.setVisibility(View.GONE);
        llPerName.setVisibility(View.VISIBLE);
        String nickName = UserUtils.getUserInfo(getActivity()).getNickname();
        if (null == nickName) {
            nickName = "";
        }
        tv_userName.setText("Welcome, " + nickName);
        textView.setText(UserUtils.getUserInfo(getActivity()).getEmail());
        ImageLoader.getInstance().displayImage(userInfo.getImage(), userIcon, ImageLoaderOptions.getImageLoaderOptions());
    } else {
        ImageLoader.getInstance().displayImage("", userIcon, ImageLoaderOptions.getImageLoaderOptions());
        btnLogin.setVisibility(View.VISIBLE);
        llPerName.setVisibility(View.GONE);
    }
}
项目:boohee_v5.6    文件:AppRecommendListAdapter.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(this.ctx).inflate(R.layout.e6, null);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);
        holder.name = (TextView) convertView.findViewById(R.id.name);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    ImageLoader imageLoader = this.imageLoader;
    StringBuilder stringBuilder = new StringBuilder();
    BooheeClient.build(BooheeClient.ONE);
    imageLoader.displayImage(stringBuilder.append(BooheeClient.getHost(BooheeClient.ONE))
            .append(getItem(position).icon).toString(), holder.icon, this.option);
    holder.name.setText(getItem(position).name);
    return convertView;
}
项目:androidgithub    文件:PTApplication.java   
@Override
public void onCreate() {
    super.onCreate();
    sContext = this;
    appComponent = DaggerAppComponent.builder()
            .baseComponent(baseComponent)
            .build();

    Fresco.initialize(getApplicationContext(),
            ImagePipelineFactory.imagePipelineConfig(getApplicationContext()
                    , getAppComponent().okHttpClient()
                    , getCacheDir().getAbsolutePath()));

    //ImageLoader初始化
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(configuration);

    DBManager.init(this);
    if (AccountHelper.isLogin())
        DBManager.initDefaultRealm(AccountHelper.getCurrentUid(), APPRealmMigration.VERSION, new APPRealmMigration());
    startService(new Intent(this, InitializeIntentService.class));
}
项目:EveryCoolPic    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();
    mContext = this;
    ImageLoader.getInstance().init(new ImageLoaderConfiguration.Builder(this)
            .diskCache(new UnlimitedDiskCache(getCacheDir()))
            .build());
}
项目:GitHub    文件:ImageLoaderUtil.java   
/**初始化方法
 * @must 使用其它方法前必须调用,建议在自定义Application的onCreate方法中调用
 * @param context
 */
public static void init(Context context) {
    if (context == null) {
        Log.e(TAG, "\n\n\n\n\n !!!!!!  <<<<<< init  context == null >> return; >>>>>>>> \n\n\n\n");
        return;
    }
    imageLoader = ImageLoader.getInstance();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
    .defaultDisplayImageOptions(getOption(0))
    // .threadPoolSize(5)
    // //.threadPriority(Thread.MIN_PRIORITY + 3)
    .tasksProcessingOrder(QueueProcessingType.LIFO)
    // .discCacheSize((int)(Runtime.getRuntime().maxMemory()/2))
    // .discCache(new UnlimitedDiscCache(getCachePath()))
    // .memoryCacheSize(2 * 1024 * 1024)
    // .memoryCacheExtraOptions(147, 147)
    // .writeDebugLogs()
    // .httpConnectTimeout(5000)
    // .httpReadTimeout(20000)
    .diskCacheExtraOptions(ScreenUtil.getScreenWidth(context), ScreenUtil.getScreenHeight(context), null)
    .threadPriority(Thread.NORM_PRIORITY - 2)
    .denyCacheImageMultipleSizesInMemory()
    .diskCacheSize(50 * 1024 * 1024) // 50 Mb
    // .displayer(new RoundedBitmapDisplayer(5))
    .build();

    imageLoader.init(config);
}
项目:GitHub    文件:ImageLoaderUtil.java   
/**初始化方法
 * @must 使用其它方法前必须调用,建议在自定义Application的onCreate方法中调用
 * @param context
 */
public static void init(Context context) {
    if (context == null) {
        Log.e(TAG, "\n\n\n\n\n !!!!!!  <<<<<< init  context == null >> return; >>>>>>>> \n\n\n\n");
        return;
    }
    imageLoader = ImageLoader.getInstance();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
    .defaultDisplayImageOptions(getOption(0))
    // .threadPoolSize(5)
    // //.threadPriority(Thread.MIN_PRIORITY + 3)
    .tasksProcessingOrder(QueueProcessingType.LIFO)
    // .discCacheSize((int)(Runtime.getRuntime().maxMemory()/2))
    // .discCache(new UnlimitedDiscCache(getCachePath()))
    // .memoryCacheSize(2 * 1024 * 1024)
    // .memoryCacheExtraOptions(147, 147)
    // .writeDebugLogs()
    // .httpConnectTimeout(5000)
    // .httpReadTimeout(20000)
    .diskCacheExtraOptions(ScreenUtil.getScreenWidth(context), ScreenUtil.getScreenHeight(context), null)
    .threadPriority(Thread.NORM_PRIORITY - 2)
    .denyCacheImageMultipleSizesInMemory()
    .diskCacheSize(50 * 1024 * 1024) // 50 Mb
    // .displayer(new RoundedBitmapDisplayer(5))
    .build();

    imageLoader.init(config);
}
项目:GitHub    文件:DetailActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    imageView = (ImageView) findViewById(R.id.image);
    address1 = findViewById(R.id.address1);
    address2 = findViewById(R.id.address2);
    address3 = findViewById(R.id.address3);
    address4 = findViewById(R.id.address4);
    address5 = findViewById(R.id.address5);
    ratingBar = (RatingBar) findViewById(R.id.rating);
    listContainer = (LinearLayout) findViewById(R.id.detail_list_container);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = getWindow();
        window.setFlags(
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    String imageUrl = getIntent().getStringExtra(EXTRA_IMAGE_URL);
    ImageLoader.getInstance().displayImage(imageUrl, imageView);

    ViewCompat.setTransitionName(imageView, IMAGE_TRANSITION_NAME);
    ViewCompat.setTransitionName(address1, ADDRESS1_TRANSITION_NAME);
    ViewCompat.setTransitionName(address2, ADDRESS2_TRANSITION_NAME);
    ViewCompat.setTransitionName(address3, ADDRESS3_TRANSITION_NAME);
    ViewCompat.setTransitionName(address4, ADDRESS4_TRANSITION_NAME);
    ViewCompat.setTransitionName(address5, ADDRESS5_TRANSITION_NAME);
    ViewCompat.setTransitionName(ratingBar, RATINGBAR_TRANSITION_NAME);

    dealListView();
}
项目:boohee_v5.6    文件:PhotoBrowserFragment.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.imageLoader = ImageLoader.getInstance();
    if (getArguments() != null) {
        this.mImageUrl = getArguments().getString(KEY_IMAGE_URL);
    }
}
项目:GitHub    文件:BaseFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.item_clear_memory_cache:
            ImageLoader.getInstance().clearMemoryCache();
            return true;
        case R.id.item_clear_disc_cache:
            ImageLoader.getInstance().clearDiskCache();
            return true;
        default:
            return false;
    }
}
项目:GitHub    文件:HomeActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.item_clear_memory_cache:
            ImageLoader.getInstance().clearMemoryCache();
            return true;
        case R.id.item_clear_disc_cache:
            ImageLoader.getInstance().clearDiskCache();
            return true;
        default:
            return false;
    }
}
项目:sctalk    文件:ImageLoaderUtil.java   
public static void initImageLoaderConfig(Context context) {
        try {
            File cacheDir = StorageUtils.getOwnCacheDirectory(context, CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE));
            File reserveCacheDir = StorageUtils.getCacheDirectory(context);

            int maxMemory = (int) (Runtime.getRuntime().maxMemory() );
            // 使用最大可用内存值的1/8作为缓存的大小。
            int cacheSize = maxMemory/8;
            DisplayMetrics metrics=new DisplayMetrics();
            WindowManager mWm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
            mWm.getDefaultDisplay().getMetrics(metrics);

            IMImageLoaderConfig = new ImageLoaderConfiguration.Builder(context)
                    .memoryCacheExtraOptions(metrics.widthPixels, metrics.heightPixels)
                    .threadPriority(Thread.NORM_PRIORITY-2)
//                    .denyCacheImageMultipleSizesInMemory()
                    .memoryCache(new UsingFreqLimitedMemoryCache(cacheSize))
                    .diskCacheFileNameGenerator(new Md5FileNameGenerator())
                    .tasksProcessingOrder(QueueProcessingType.LIFO)
                    .diskCacheExtraOptions(metrics.widthPixels, metrics.heightPixels, null)
                    .diskCache(new UnlimitedDiscCache(cacheDir,reserveCacheDir,new Md5FileNameGenerator()))
                    .diskCacheSize(1024 * 1024 * 1024)
                    .diskCacheFileCount(1000)
                    .build();

            IMImageLoadInstance = ImageLoader.getInstance();
            IMImageLoadInstance.init(IMImageLoaderConfig);
        }catch (Exception e){
            logger.e(e.toString());
        }
    }
项目:Rey-MusicPlayer    文件:SongsAdapter.java   
@Override
public void onBindViewHolder(SongsAdapter.ItemHolder itemHolder, int position) {
    switch (itemHolder.getItemViewType()) {
        default:
            SongsAdapter.SongHolder holder = (SongsAdapter.SongHolder) itemHolder;
            holder.title.setText(mData.get(position)._title);
            holder.artist.setText(mData.get(position)._artist);
            holder.duration.setText(MusicUtils.makeShortTimeString(mContext, mData.get(position)._duration / 1000));
            holder.mAlbumArt.setVisibility(View.VISIBLE);
            ImageLoader.getInstance().displayImage(MusicUtils.getAlbumArtUri(mData.get(position)._albumId).toString(), holder.mAlbumArt);

            break;
    }
}
项目:GifImageLoader    文件:BaseFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.item_clear_memory_cache:
            ImageLoader.getInstance().clearMemoryCache();
            return true;
        case R.id.item_clear_disc_cache:
            ImageLoader.getInstance().clearDiskCache();
            return true;
        default:
            return false;
    }
}
项目:mobile-store    文件:AppDetailsAdapterTest.java   
@Before
public void setup() {
    ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(context));
    Preferences.setup(context);

    Repo repo = RepoProviderTest.insertRepo(context, "http://www.example.com/fdroid/repo", "", "", "Test Repo");
    app = AppProviderTest.insertApp(contentResolver, context, "com.example.app", "Test App",
            new ContentValues(), repo.getId());
}
项目:Rey-MusicPlayer    文件:ArtistArtDownloadService.java   
public String putBitmapInDiskCache(long artistId, String artistName, LastFmInterface lastFmInterface) {
    File cacheDir = new File(Common.getInstance().getCacheDir(), "artistThumbnails");
    Bitmap avatar = null;

    if (!cacheDir.exists()) {
        cacheDir.mkdirs();
    }

    File cacheFile = new File(cacheDir, "" + artistId);
    try {
        if (cacheFile.exists()) {
            return "file://" + cacheFile.getPath();
        } else {
            cacheFile.createNewFile();
        }


        Response<ArtistModel> responseBodyCall = lastFmInterface.getArtist(artistName).execute();
        if (responseBodyCall.isSuccessful()) {
            avatar = ImageLoader.getInstance().loadImageSync(responseBodyCall.body().artist.image.get(4).url);
        }

        if (avatar != null) {
            FileOutputStream fos = new FileOutputStream(cacheFile);
            avatar.compress(Bitmap.CompressFormat.PNG, 100, fos);
            fos.flush();
            fos.close();
            return "file://" + cacheFile.getPath();
        } else {
            cacheFile.delete();
            return null;
        }
    } catch (Exception e) {
        Logger.log("" + e.getCause());
        return null;
    }
}
项目:TYT    文件:MyApplication.java   
/**
 * 初始化ImageLoader
 */
public static void initImageLoader(Context context) {
    // 哪个地方想要清除自定义路径下的缓存,就在那里调用这个方法
    //  ImageLoader.getInstance().clearDiscCache(); // 清除自定义的ImageLoader缓存的图片

    // 自定义的缓存路径ImageLoaderCache:sdcard/picture/ImageLoaderCache ,属于外部缓存
    File cacheDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "ImageLoaderCache");
    if (!cacheDir.exists()) {
        cacheDir.mkdir();
    }

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // maxwidth, max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)//线程池内加载的数量
            .denyCacheImageMultipleSizesInMemory()
            //.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) //你可以通过自己的内存缓存实现,那么getCache()就能获取到缓存图片,在data/data/xxx.xxx.xxx/cache 文件夹下
            //.memoryCacheSize(2 * 1024 * 1024)  // 内存缓存大小
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .diskCacheFileCount(100) //缓存图片的个数
            .discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径 ,这个注释的话,就没有自定的缓存了,不过还可以设置内部缓存
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for releaseapp
            .build();//开始构建
    ImageLoader.getInstance().init(config);

}
项目:Selector    文件:MyApplication.java   
@Override
public void onCreate() {
    super.onCreate();
    context = this.getApplicationContext();
    Fresco.initialize(this);
    CookieJarImpl cookieJar1 = new CookieJarImpl(new MemoryCookieStore());
    OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .connectTimeout(10000L, TimeUnit.MILLISECONDS)
            .readTimeout(10000L, TimeUnit.MILLISECONDS)
            .addInterceptor(new LoggerInterceptor("TAG"))
            .cookieJar(cookieJar1)
            .build();
    OkHttpUtils.initClient(okHttpClient);




    MultiDex.install(this);

    //开启debug模式,方便定位错误,具体错误检查方式可以查看http://dev.umeng.com/social/android/quick-integration的报错必看,正式发布,请关闭该模式
    //Config.DEBUG = true;

    initXY(context);
    //Thread.setDefaultUncaughtExceptionHandler(crashHandler);
    SharedPreferencesUtil.init(context,"deepSP",MODE_PRIVATE);
    /**
     * 初始化imageloader
     */
    ImageLoaderConfiguration configuration = ImageLoaderConfiguration.createDefault(this);
    ImageLoader.getInstance().init(configuration);
}
项目:APIJSON-Android-RxJava    文件:ImageLoaderUtil.java   
/**初始化方法
 * @must 使用其它方法前必须调用,建议在自定义Application的onCreate方法中调用
 * @param context
 */
public static void init(Context context) {
    if (context == null) {
        Log.e(TAG, "\n\n\n\n\n !!!!!!  <<<<<< init  context == null >> return; >>>>>>>> \n\n\n\n");
        return;
    }
    imageLoader = ImageLoader.getInstance();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
    .defaultDisplayImageOptions(getOption(0))
    // .threadPoolSize(5)
    // //.threadPriority(Thread.MIN_PRIORITY + 3)
    .tasksProcessingOrder(QueueProcessingType.LIFO)
    // .discCacheSize((int)(Runtime.getRuntime().maxMemory()/2))
    // .discCache(new UnlimitedDiscCache(getCachePath()))
    // .memoryCacheSize(2 * 1024 * 1024)
    // .memoryCacheExtraOptions(147, 147)
    // .writeDebugLogs()
    // .httpConnectTimeout(5000)
    // .httpReadTimeout(20000)
    .diskCacheExtraOptions(ScreenUtil.getScreenWidth(context), ScreenUtil.getScreenHeight(context), null)
    .threadPriority(Thread.NORM_PRIORITY - 2)
    .denyCacheImageMultipleSizesInMemory()
    .diskCacheSize(50 * 1024 * 1024) // 50 Mb
    // .displayer(new RoundedBitmapDisplayer(5))
    .build();

    imageLoader.init(config);
}
项目:quickhybrid-android    文件:NavigatorApi.java   
/**
 * 设置导航栏最右侧按钮
 * <p>
 * 参数:
 * isShow:是否显示,0:隐藏 其他:显示
 * text:文字按钮
 * imageUrl:图片按钮,格式为url地址,优先级高
 */
public static void setRightBtn(IQuickFragment webLoader, WebView wv, JSONObject param, Callback callback) {
    int which = param.optInt("which", 0);
    boolean isShow = !"0".equals(param.optString("isShow"));
    String text = param.optString("text");
    String imageUrl = param.optString("imageUrl");
    INbControl.ViewHolder holder = webLoader.getPageControl().getNbBar().getViewHolder();
    if (isShow) {
        if (!TextUtils.isEmpty(imageUrl)) {
            //设置图片
            holder.nbRightIvs[which].setVisibility(View.INVISIBLE);
            holder.nbRightTvs[which].setVisibility(View.INVISIBLE);
            ImageLoader.getInstance().displayImage(imageUrl, holder.nbRightIvs[which], AppUtil.getImageLoaderOptions(0, 0, true, true));
            holder.nbRightIvs[which].setVisibility(View.VISIBLE);
        } else {
            //设置文字
            holder.nbRightIvs[which].setVisibility(View.INVISIBLE);
            holder.nbRightTvs[which].setVisibility(View.VISIBLE);
            holder.nbRightTvs[which].setText(text);
        }
        webLoader.getWebloaderControl().addPort(AutoCallbackDefined.OnClickNbRight + which, callback.getPort());
    } else {
        //隐藏按钮
        holder.nbRightTvs[which].setVisibility(View.INVISIBLE);
        holder.nbRightIvs[which].setVisibility(View.INVISIBLE);
        webLoader.getWebloaderControl().removePort(AutoCallbackDefined.OnClickNbRight + which);
    }
}
项目:wallpaperboard    文件:WallpaperDetailsCategoryAdapter.java   
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Category category = mCategories.get(position);
    holder.title.setText(category.getName());

    ImageLoader.getInstance().displayImage(
            category.getThumbUrl(),
            new ImageViewAware(holder.image),
            mOptions.build(),
            ImageConfig.getBigThumbnailSize(),
            null,
            null);
}