private void downloadImage() { MobclickAgent.onEvent(getActivity(), Event.STATUS_SAVE_IMAGE_OK); this.imageLoader.loadImage(this.imageUrl, new SimpleImageLoadingListener() { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (!HomePopView.this.isRemoved()) { String result = FileUtil.downloadImage2Gallery(HomePopView.this.getActivity() , loadedImage, new Md5FileNameGenerator().generate(HomePopView.this .imageUrl)); if (TextUtils.isEmpty(result)) { Helper.showToast((CharSequence) "保存图片失败,请重新保存~~"); } else { Helper.showToast("图片已保存到" + result); } HomePopView.this.ivDownload.setEnabled(true); } } }); }
@Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.gallery_item, parent, false); ViewGroup.LayoutParams params = convertView.findViewById(R.id.image).getLayoutParams(); params.width = params.height = width; } final ImageView iv_image = (ImageView) convertView.findViewById(R.id.image); final String uri = "file://" + data.get(position).path; imageLoader.displayImage(uri, iv_image, new SimpleImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { iv_image.setImageResource(R.drawable.picture_unavailable); super.onLoadingStarted(imageUri, view); } }); return convertView; }
@Override public void onBindViewHolder(final ViewHolder holder, final int position) { ButtonData item = items.get(position); if (type == TYPE_ASSET) { ImageLoader.getInstance().loadImage(urlsToAssets.get(position), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { holder.button.setImageBitmap(loadedImage); } }); } else if (type == TYPE_DRAWABLE) { holder.button.setImageDrawable(App.getVecDrawable(holder.itemView.getContext(), item.getIconRes())); //holder.button.setColorFilter(colorFilter); } if (item.getTitle() == null) { holder.title.setVisibility(View.GONE); holder.itemView.setContentDescription(item.getText()); } else { holder.itemView.setContentDescription(item.getTitle()); holder.title.setText(item.getTitle()); holder.title.setVisibility(View.VISIBLE); } }
@Override public void load(String path, int defaultRes, ImageView iv, final AbsImageLoader.ImageLoadingListener listener) { if(!TextUtils.isEmpty(path)) { if (!path.equals(iv.getTag())) { iv.setTag(path); ImageAware imageAware = new ImageViewAware(iv, false); ImageLoader.getInstance().displayImage(path, imageAware, getDefaultOptions(false, defaultRes), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if(listener!=null){ listener.onSuccess(imageUri, view); } } }); } }else{ iv.setImageResource(defaultRes); } }
private void updatePersonalInfo(User user) { personalName.setText(user.getNick()); personalSign.setText(user.getSignature()); ImageLoader.getInstance().displayImage(user.getAvatar(), personalIcon, ImageLoadOptions.getOptions(), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { // TODO Auto-generated method stub super.onLoadingComplete(imageUri, view, loadedImage); L.i(TAG, "load personal icon completed."); } } ); }
@Override protected void onPostExecute(String uri) { ImageLoader.getInstance().displayImage(uri, playlistImage, new DisplayImageOptions.Builder().cacheInMemory(true) .showImageOnFail(R.drawable.ic_empty_music2) .resetViewBeforeLoading(true) .build(), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { } }); songcount.setText(" " + String.valueOf(songCountInt) + " " + mContext.getString(R.string.songs)); }
@Override public void bindVoiceData(StickerAdapt2Result stickerAdapt2Result) { mViewDrawableOverlay.post(this::loadSticker); if (stickerAdapt2Result.getScenes().size() > 0) ImageLoader.getInstance().displayImage(Constants.setAliyunImageUrl(stickerAdapt2Result.getScenes().get(0).getImgname_url()), mIvBackground, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); Observable.just(loadedImage) .subscribeOn(Schedulers.io()) .observeOn(Schedulers.io()) .filter(loadedImg -> loadedImg != null && !loadedImg.isRecycled()) .subscribe(loadedImg -> { int hashName = FileUtil.STICKER_BG_NAME.hashCode(); FileUtil.saveBitmap(FileUtil.getAppFilePath(FileUtil.DIR_STICKERS) + hashName, loadedImage); }, Throwable::printStackTrace); } }); }
public void displayImage(MQImageView imageView, String path, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final MQDisplayImageListener displayImageListener) { initImageLoader(imageView.getContext()); if (path == null) { path = ""; } if (!(path.startsWith("http") || path.startsWith("file"))) { path = "file://" + path; } String str = path; ImageLoader.getInstance().displayImage(str, new ImageViewAware(imageView), new DisplayImageOptions.Builder().showImageOnLoading(loadingResId).showImageOnFail (failResId).cacheInMemory(true).build(), new ImageSize(width, height), new SimpleImageLoadingListener() { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (displayImageListener != null) { displayImageListener.onSuccess(view, imageUri); } } }, null); }
private void loadBooheePic() { new Thread(new Runnable() { public void run() { for (int i = 0; i < 100; i++) { MyFavoriteActivity.this.imageUrl = String.format("http://up.boohee" + ".cn/house/u/one/reminder/%d.jpg", new Object[]{Integer.valueOf(i)}); MyFavoriteActivity.this.imageLoader.loadImage(MyFavoriteActivity.this .imageUrl, new SimpleImageLoadingListener() { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); new SaveImageTask().execute(new Bitmap[]{loadedImage}); } }); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start(); }
/** * ImageLoader异步加载 */ private void doLoadImage(final boolean needLoad, final String tag, final String url, final int thumbSize) { if (needLoad) { setTag(tag); // 解决ViewHolder复用问题 /** * 若使用网易云信云存储,这里可以设置下载图片的压缩尺寸,生成下载URL * 如果图片来源是非网易云信云存储,请不要使用NosThumbImageUtil */ final String thumbUrl = makeAvatarThumbNosUrl(url, thumbSize); // 异步从cache or NOS加载图片 ImageLoader.getInstance().displayImage(thumbUrl, new NonViewAware(new ImageSize(thumbSize, thumbSize), ViewScaleType.CROP), options, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (getTag() != null && getTag().equals(tag)) { setImageBitmap(loadedImage); } } }); } else { setTag(null); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.assistant_metro_activity_map_view); String cityName = getIntent().getStringExtra("name"); final String imageUrl = getIntent().getStringExtra("imageUrl"); Log.d(">>>imageUrl", imageUrl); UIHelp.setHeaderMenuView(this, cityName + "地铁线路图"); imageView = (GestureImageView) findViewById(R.id.imageView); ImageLoadUtil.getInstance().loadImage(imageUrl, new SimpleImageLoadingListener(){ @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { imageView.setImageBitmap(loadedImage); } }); }
private void setToolbarAndStatusColorAccordingToEventImage() { if(event.hasImage()) { MyImageLoader.getInstance().getImageLoader().loadImage(event.getImage(), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); Palette.from(loadedImage).generate(new Palette.PaletteAsyncListener() { @Override public void onGenerated(Palette palette) { int darkVibrantColor = palette.getDarkVibrantColor(getResources().getColor(R.color.primaryDark)); int vibrantColor = palette.getVibrantColor(getResources().getColor(R.color.primary)); collapsingToolbarLayout.setContentScrimColor(vibrantColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = EventDetailActivity.this.getWindow(); window.setStatusBarColor(darkVibrantColor); } } }); } }); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pic_detail); ButterKnife.bind(this); imgUrl = getIntent().getStringExtra("IMAGE_URL"); photoViewAttacher = new PhotoViewAttacher(pvPic); DisplayImageOptions options = new DisplayImageOptions.Builder() .cacheOnDisk(true).considerExifParams(true).build(); ImageLoader.getInstance().displayImage(imgUrl,pvPic,options, new SimpleImageLoadingListener(){ @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { progressBar.setVisibility(View.GONE); photoViewAttacher.update(); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_beauty, container, false); mBeautyImg = (ImageView) v.findViewById(R.id.beautyImg); mAttacher = new PhotoViewAttacher(mBeautyImg); ImageLoaderUtil.displayImage(url, mBeautyImg, ImageLoaderUtil.getDefaultOptions(),new SimpleImageLoadingListener(){ @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); mAttacher.update(); } }); return v; }
/** * Method fillInfo * all written info is filled * * @param filmDetail */ private void fillImage(FilmDetailsJSONEntity filmDetail) { // Finally the image loaded by Universal Image Loader library final String titleOfFilm = filmDetail.getTitle(); // Load image, decode it to Bitmap and return Bitmap to callback ImageLoader.getInstance().displayImage(filmDetail.getUrlPoster(), imgExtended, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { // Do whatever you want with Bitmap Palette.generateAsync(loadedImage, new Palette.PaletteAsyncListener() { public void onGenerated(Palette palette) { applyPalette(palette, titleOfFilm); } }); } }); }
public static void notifyFrom(final Context context, final String nick, final String text, String imgUrl){ if(!TextUtils.isEmpty(imgUrl)) { ImageLoader.getInstance().loadImage(ProjectTool.fixUrl(imgUrl), new SimpleImageLoadingListener(){ @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { // send notify sendMessage(context, nick, text, loadedImage); } }); } else { sendMessage(context, nick, text, null); } }
static void loadImage(final Context context, String source, final LoadImageDone l, final URLDrawable b) { ImageSize size = new ImageSize(200, 150); ImageLoader.getInstance().loadImage(source, size, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { ImageLoader.getInstance().getMemoryCache().put(imageUri, loadedImage); BitmapDrawable drawable = new BitmapDrawable(context.getResources(), loadedImage); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); b.drawable = drawable; if (l != null) l.loadImageComplete(); } }); }
public void loadImage(){ if(imageData==null) return; if(imageData.getThumb().contains(".gif")){ Ion.with(image) .animateGif(AnimateGifMode.ANIMATE) // .animateLoad(R.anim.spin_animation) .smartSize(true) .error(R.drawable.missing_preview) .load(imageData.getThumb()); } else { ImageLoader.getInstance().displayImage(imageData.getThumb(), image, new SimpleImageLoadingListener(){ @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { imageData.setWidth(loadedImage.getWidth()); imageData.setHeight(loadedImage.getHeight()); ViewGroup parent = (ViewGroup) view.getParent(); if(parent instanceof MosaicView){ // Log.d("MosaicView rebuildViews", "onLoadingComplete: "); ((MosaicView) parent).rebuildViews(); } else { invalidateSize(); } } }); } }
public void setEntry(PollItemEntry entry) { this.entry = entry; ImageLoader imageLoader = ImageLoaderInitializer.getImageLoader(getContext()); if (entry.getPreviewUrl() != null) { imageLoader.displayImage(ApiUI.resolveUrl(entry.getPreviewUrl()), imageView, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { // animation lags on QuestionDetailsActivity // any way image is in the cache (it was clicked in the list) // so animation is not needed if (getContext().getClass() == QuestionDetailsActivity.class) return; Animation anim = AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in); imageView.setAnimation(anim); anim.start(); } }); } ratingText.setText(Integer.toString(entry.getVotesCount())); setMarked(entry.isVoted()); }
private void sendNotification(final String messaggio, final String titolo, String urlicona) { mNotificationManager = (NotificationManager) this .getSystemService(Context.NOTIFICATION_SERVICE); final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); final Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.notification); // Load image, decode it to Bitmap and return Bitmap to callback ImageSize targetSize = new ImageSize(50, 50); ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.loadImage(urlicona, targetSize, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { setIcon(loadedImage); int NOTIFICATION_ID = randInt(0,100); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(GcmIntentService.this) .setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(getIcon()) .setContentTitle(titolo) .setStyle(new NotificationCompat.BigTextStyle().bigText(messaggio)) .setSound(sound) .setContentText(messaggio); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } }); }
private void shareImage(final String finalUrl) { ((Reddit) getApplication()).getImageLoader() .loadImage(finalUrl, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { shareImage(loadedImage); } }); }
private void shareImage(final String finalUrl) { ((Reddit) getApplication()).getImageLoader() .loadImage(finalUrl, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { shareImage(loadedImage, finalUrl); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate( R.layout.submission_imagecard, container, false); final SubsamplingScaleImageView image = (SubsamplingScaleImageView) rootView.findViewById(R.id.image); TextView title = (TextView) rootView.findViewById(R.id.title); TextView desc = (TextView) rootView.findViewById(R.id.desc); title.setVisibility(View.GONE); desc.setVisibility(View.GONE); ((Reddit) getContext().getApplicationContext()).getImageLoader() .loadImage(url, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { image.setImage(ImageSource.bitmap(loadedImage)); } }); return rootView; }
private void init() { // TODO 自动生成的方法存根 imageView = (ImageView) findViewById(R.id.cat_big_picture_imageview); mAttacher = new PhotoViewAttacher(imageView); mAttacher.setOnPhotoTapListener(new OnPhotoTapListener() { @Override public void onPhotoTap(View arg0, float arg1, float arg2) { finish(); } }); // 使用ImageLoader加载网络图片 // DisplayImageOptions options = new DisplayImageOptions.Builder()// // .showImageOnLoading(R.drawable.ic_launcher) // 加载中显示的默认图片 // .showImageOnFail(R.drawable.ic_launcher) // 设置加载失败的默认图片 // .cacheInMemory(true) // 内存缓存 // .cacheOnDisk(true) // sdcard缓存 // .bitmapConfig(Config.RGB_565)// 设置最低配置 // .imageScaleType(ImageScaleType.EXACTLY)// 缩放图片 // .build(); ImageLoader.getInstance().displayImage(path, imageView, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { mAttacher.update(); } }); }
public static final void setImage(Context ctx, final ImageView imgView, final int roundRadius, String url) { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.ic_dots_horizontal_white_48dp) .showImageOnFail(R.drawable.ic_close_white_48dp) .cacheInMemory(true) .cacheOnDisk(true) .displayer(roundRadius > 0 ? new RoundedBitmapDisplayer(roundRadius) : new SimpleBitmapDisplayer()) .build(); ImageUtil.getImageLoader(ctx).displayImage(url, imgView, options, new SimpleImageLoadingListener() { public void onLoadingComplete(String uri, View view, Bitmap loadedImage) { if (roundRadius > 0) { imgView.setPadding(0, 0, 0, 0); } } }); }
public void show(String path) { if (!StringUtil.isEmpty(path)) { ImageLoader.getInstance().loadImage("file:///" + path, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); ImageDialog.this.setImg(loadedImage); show(); } }); } }
@Override public View getView(int position, View convertView, final ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); LayoutInflater infalter = getInflater(parent); convertView = infalter.inflate(R.layout.item_gallery, null); holder.img = (ImageView) convertView.findViewById(R.id.image_item); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } imageLoader.displayImage("file:///" + getItem(position), holder.img, new SimpleImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { super.onLoadingStarted(imageUri, view); holder.img.setImageResource(parent.getContext().getResources().getColor(R.color.gallery_item_backgroud_color)); } }); return convertView; }
private void updateImg(final Intent intent) { if (intent == null) { finish(PostActivity.this); return; } imgPath = intent.getStringExtra(Message.SIGN.IMAGE_PATH); if (imgPath != null) { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.empty_bg) .showImageOnFail(R.drawable.empty_bg) .cacheInMemory(true) .cacheOnDisk(false) .considerExifParams(true) .build(); ImageLoader.getInstance().loadImage("file:///" + imgPath, options, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); imgviewImg.setImageBitmap(loadedImage); imgBitmap = loadedImage; } }); } else { imgviewImg.setImageDrawable(getResources().getDrawable(R.drawable.empty_bg)); } }
private void updateInfo(User user) { tvEmail.setText(user.getEmail()); if (StringUtil.isEmpty(user.getNickname())) { setTextViewEmpty(tvNickName); } else { tvNickName.setTextColor(getResources().getColor(R.color.gray_deep)); tvNickName.setText(user.getNickname()); } if (StringUtil.isEmpty(user.getMotto())) { setTextViewEmpty(tvMotto); } else { tvMotto.setTextColor(getResources().getColor(R.color.gray_deep)); tvMotto.setText(user.getMotto()); } if (!StringUtil.isEmpty(user.getAvatar())) { String avatarUrl = ImageUtil.getNormalImgUrl(user.getAvatar()); ImageLoader.getInstance().loadImage(avatarUrl, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); imgAvatar.setImageBitmap(loadedImage); } }); } if (!StringUtil.isEmpty(user.getWallpaper())) { String wallpaperUrl = ImageUtil.getNormalImgUrl(user.getWallpaper()); loader.displayImage(wallpaperUrl, imgWallpaper); } tvStatus.setText(user.getStatus() == 0 ? "未认证" : "已认证"); }
private void initAttrs() { mAdapter = new CommentAdapter(); lvComment.setAdapter(mAdapter); lvComment.setOnItemClickListener(this); lvComment.setShowFooterWhenNoMore(true); lvComment.setItemsCanFocus(true); mSwipeLayout.setOnRefreshListener(this); mSwipeLayout.setColorSchemeResources(R.color.swipe_progress_green_color, R.color.red); imgCommit.setOnClickListener(this); edtCommentInput.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { checkCommentParam(); return true; } }); if (!StringUtil.isEmpty(User.getInstance().getAvatar())) { String avatarUrl = ImageUtil.getNormalImgUrl(User.getInstance().getAvatar()); ImageLoader.getInstance().loadImage(avatarUrl, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); masterAvatar.setImageBitmap(loadedImage); } }); } }
private void setImage(final String filePath) { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.empty_bg) .showImageOnFail(R.drawable.empty_bg) .cacheInMemory(true) .cacheOnDisk(false) .considerExifParams(true) .build(); ImageLoader.getInstance().loadImage("file:///" + filePath, options, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); cropImageView.setImageBitmap(loadedImage); originImage = loadedImage; } }); }
private void updateMapFromServer() { new HttpUtil.Build(this, Api.API.GET_SHARE_LOCATION) .put(Api.PARAM.SID, mSelected.getSid()) .post(new HttpUtil.OnQuery() { @Override public void onQueryResult(HttpResult result) { if (result.isSuccess()) { Location location = JsonParse.parseData(result.getData(), Location.class); String url = BaiduGeocodingUtil.getStaticMapRequestUrl(location.getLongitude(), location.getLatitude()); getLoader().loadImage(url, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); imgMap.setVisibility(View.VISIBLE); mapBitmap = loadedImage; } }); } else { imgMap.setVisibility(View.GONE); } } }); }
public static void downloadImage(String url, int maxHeight, SimpleImageLoadingListener listener, Context context) { AppDeck appDeck = AppDeck.getInstance(); final int height = maxHeight; DisplayImageOptions options = appDeck.getDisplayImageOptionsBuilder() .preProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap in) { // TODO Auto-generated method stub int width = in.getWidth() * height / in.getHeight(); if (width > 0 && height > 0) return Bitmap.createScaledBitmap(in, width, height, true); return in; } }) .build(); // Load image, decode it to Bitmap and return Bitmap to callback //appDeck.imageLoader.loadImage(url, options, listener); ImageSize targetSize = new ImageSize(0, 0); ImageView fakeImage = new ImageView(context); fakeImage.setLayoutParams(new LayoutParams(targetSize.getWidth(), targetSize.getHeight())); fakeImage.setScaleType(ScaleType.CENTER_CROP); appDeck.imageLoader.displayImage(url, fakeImage, options, new Utils.FakeImageSimpleImageLoadingListener(fakeImage, listener) {}); }
public static void downloadIcon(String url, final int maxHeight, SimpleImageLoadingListener listener, Context context) { AppDeck appDeck = AppDeck.getInstance(); DisplayImageOptions options = appDeck.getDisplayImageOptionsBuilder() .preProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap in) { // TODO Auto-generated method stub int height = maxHeight; int width = in.getWidth() * height / in.getHeight(); if (width > 0 && height > 0) return Bitmap.createScaledBitmap(in, width, height, true); return in; } }) .build(); // Load image, decode it to Bitmap and return Bitmap to callback ImageSize targetSize = new ImageSize(maxHeight, maxHeight); // result Bitmap will be fit to this size //appDeck.imageLoader.loadImage(url, targetSize, options, listener); ImageView fakeImage = new ImageView(context); fakeImage.setLayoutParams(new LayoutParams(targetSize.getWidth(), targetSize.getHeight())); fakeImage.setScaleType(ScaleType.CENTER_CROP); appDeck.imageLoader.displayImage(url, fakeImage, options, new Utils.FakeImageSimpleImageLoadingListener(fakeImage, listener) {}); }
public void bindValue(User user) { ImageLoader.getInstance().displayImage(user.getAvatarUrl(), imageViewAvatar, Constants.avatarDisplayOption, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); /*if (loadedImage != null) { Bitmap bg = BitmapUtil.fastblur(loadedImage, 30); mainFrame.setBackgroundDrawable(new BitmapDrawable(bg)); } else { mainFrame.setBackgroundResource(R.drawable.card_bg_normal); }*/ } }); textViewName.setText(user.getName()); textViewInfo.setText(Html.fromHtml(user.getInfo())); }
public static SimpleImageLoadingListener getAnimateFirstDisplayListener() { return new SimpleImageLoadingListener() { final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>()); @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (loadedImage != null) { ImageView imageView = (ImageView) view; boolean firstDisplay = !displayedImages.contains(imageUri); if (firstDisplay) { FadeInBitmapDisplayer.animate(imageView, 500); displayedImages.add(imageUri); } } } }; }
private void loadImage(String url, ImageView imageView, final PhotoViewAttacher attacher) { ImageLoader.getInstance().displayImage(url, imageView, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (attacher != null) { attacher.update(); } final Note note = EVERNOTE.getNote(imageNumber); if (note != null) { setupCaptionAndImageSelectionMenu(note); } } } ); }
/** Sets a default loading listener for all display and loading tasks. */ public void setDefaultLoadingListener(ImageLoadingListener listener) { defaultListener = listener == null ? new SimpleImageLoadingListener() : listener; }