當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageLoader類代碼示例

本文整理匯總了Java中com.nostra13.universalimageloader.core.ImageLoader的典型用法代碼示例。如果您正苦於以下問題:Java ImageLoader類的具體用法?Java ImageLoader怎麽用?Java ImageLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageLoader類屬於com.nostra13.universalimageloader.core包,在下文中一共展示了ImageLoader類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:CommonFragment.java

示例2: onBindViewHolder

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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());
            }
        });
    }
}
 
開發者ID:shenhuanet,項目名稱:OpenEyesReading-android,代碼行數:18,代碼來源:DailyPicksAdapter.java

示例3: getImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:SampleUilFactory.java

示例4: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
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());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:UILApplication.java

示例5: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
/**
 * 初始化圖片載入框架
 */
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);
}
 
開發者ID:viseator,項目名稱:MontageCam,代碼行數:28,代碼來源:BaseActivity.java

示例6: onPanelStateChanged

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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();
    }
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:26,代碼來源:WallpaperBoardPreviewActivity.java

示例7: onOptionsItemSelected

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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;
    }

}
 
開發者ID:vikasdesale,項目名稱:Wings2K16,代碼行數:20,代碼來源:GalleryActivity.java

示例8: getView

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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;
}
 
開發者ID:Spencer231,項目名稱:GifImageLoader,代碼行數:21,代碼來源:ImageListFragment.java

示例9: onCreateView

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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;
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:22,代碼來源:ScreenShotsActivity.java

示例10: getView

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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;
}
 
開發者ID:qq1210514049,項目名稱:ListVideoPlayer,代碼行數:20,代碼來源:MainActivity.java

示例11: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
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);
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:17,代碼來源:RAApplication.java

示例12: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
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);
    }
 
開發者ID:rsetkus,項目名稱:rx-twitter-stream-android,代碼行數:18,代碼來源:RxTwitterApplication.java

示例13: onBindViewHolder

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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);
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:21,代碼來源:PlayingQueueAdapter.java

示例14: onBindViewHolder

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
@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);

}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:20,代碼來源:ArtistAlbumAdapter.java

示例15: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoader; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:20,代碼來源:ClientApplication.java


注:本文中的com.nostra13.universalimageloader.core.ImageLoader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。