Java 类com.bumptech.glide.request.target.GlideDrawableImageViewTarget 实例源码

项目:redpacketui-open    文件:ADPacketFragment.java   
private void showAdPacket() {
    adaptationADBanner();
    Glide.with(mContext).load(mBannerUrl).into(new GlideDrawableImageViewTarget(mAdBg) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
            super.onResourceReady(resource, animation);
            mPresenter.sendADStatistics(RPConstant.STATISTICS_TYPE_VIEW_AD, mRedPacketInfo.redPacketId);
        }
    });
    Glide.with(mContext).load(mRedPacketInfo.logoURL).transform(new CircleTransform(mContext)).into(mAdIcon);
    mLayoutBom.setBackgroundColor(Color.parseColor(mRedPacketInfo.adBgColor));
    mTVSponsor.setText(String.format(getString(R.string.money_sponsor_username_format), mRedPacketInfo.ownerName));
    if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVABLE) {//未领取
        mTVMoney.setText(mRedPacketInfo.redPacketGreeting);
    } else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVED) {//已被领取
        //myAmount大于0,说明当前用户领取到了红包
        if (Double.parseDouble(mRedPacketInfo.myAmount) > 0) {
            receiveSuccess();
        } else {//红包抢完了
            redPacketOut(getString(R.string.money_is_out));
        }
    } else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_EXPIRED) {//红包过期
        redPacketOut(getString(R.string.ad_packet_out));
    }
}
项目:PeSanKita-android    文件:ZoomingImageView.java   
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {
  subsamplingImageView.setVisibility(View.GONE);
  imageView.setVisibility(View.VISIBLE);

  Glide.with(getContext())
       .load(new DecryptableUri(masterSecret, uri))
       .diskCacheStrategy(DiskCacheStrategy.NONE)
       .dontTransform()
       .dontAnimate()
       .into(new GlideDrawableImageViewTarget(imageView) {
         @Override protected void setResource(GlideDrawable resource) {
           super.setResource(resource);
           imageViewAttacher.update();
         }
       });
}
项目:YiZhi    文件:ImageBrowseActivity.java   
/**
 * 加载gif
 */
private void loadGif() {
    Glide.with(ImageBrowseActivity.this)
            .load(mImageUrl)
            .fitCenter()
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .into(new GlideDrawableImageViewTarget(pvPic) {
                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation<?
                        super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    //在这里添加一些图片加载完成的操作
                    pbPicBrowse.setVisibility(View.GONE);
                }
            });
}
项目:tumblrlikes    文件:PhotoFragment.java   
private void showPhoto() {
    if (_photoUrl == null) {
        getRandomPhoto();
    }
    if (_photoUrl == null) return;

    String url = _photoUrl;
    if (!_photoUrl.startsWith("http")) url = "file:" + url;

    Glide
            .with(getContext())
            .load(url)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .skipMemoryCache(true)
            .into(new GlideDrawableImageViewTarget(_photoView));

    _photoRepo.startPhotoView(_photoUrl);
}
项目:Cable-Android    文件:ZoomingImageView.java   
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {
  subsamplingImageView.setVisibility(View.GONE);
  imageView.setVisibility(View.VISIBLE);

  Glide.with(getContext())
       .load(new DecryptableUri(masterSecret, uri))
       .diskCacheStrategy(DiskCacheStrategy.NONE)
       .dontTransform()
       .dontAnimate()
       .into(new GlideDrawableImageViewTarget(imageView) {
         @Override protected void setResource(GlideDrawable resource) {
           super.setResource(resource);
           imageViewAttacher.update();
         }
       });
}
项目:AndroidModulePattern    文件:ImageUtils.java   
/**
 * 显示加载进度
 *
 * @param path       图片地址
 * @param mImageView 图片控件
 * @param loadView   加载view
 */
public static void loadImageWithProgress(String path, final ImageView mImageView, final View loadView, int errorRes) {
    Glide.with(mImageView.getContext()).load(path).error(errorRes).into(new GlideDrawableImageViewTarget(mImageView) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
            super.onResourceReady(resource, animation);
            loadView.setVisibility(View.GONE);
        }

        @Override
        public void onLoadFailed(Exception e, Drawable errorDrawable) {
            super.onLoadFailed(e, errorDrawable);
            loadView.setVisibility(View.GONE);
        }
    });
}
项目:RxJavaAndRetrofitSimple    文件:SplashAdvertActivity.java   
@Override
protected void onViewCreated(Bundle savedInstanceState) {
    // 隐藏状态栏
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    splashAdvEntity = (SplashAdvEntity) getIntent().getSerializableExtra("splashAdvEntity");
    Glide.with(BaseApplication.getInstance())
            .load(new File(splashAdvEntity.filePath))
            .error(R.mipmap.firing_page)
            .into(new GlideDrawableImageViewTarget(ivSplash) {
                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    timer.schedule(task, 1000, 1000);
                }

                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    toNext();
                }
            });
}
项目:tribbble    文件:ArchiveItemView.java   
public void bind(Shot shot, @DrawableRes int placeholderId) {
  mGifLabel.setVisibility(shot.isAnimated() ? VISIBLE : INVISIBLE);
  Glide.with(getContext())
      .load(shot.getImages().getHighResImage())
      .placeholder(placeholderId)
      .diskCacheStrategy(DiskCacheStrategy.SOURCE)
      .into(new GlideDrawableImageViewTarget(mShotImageView) {
        @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
          super.onResourceReady(resource, animation);
          resource.stop();
        }

        @Override public void onStart() {}

        @Override public void onStop() {}
      });
}
项目:Album    文件:GlideHelper.java   
public static void loadResource(@DrawableRes int drawableId, @NonNull ImageView image) {
    DisplayMetrics metrics = image.getResources().getDisplayMetrics();
    final int w = metrics.widthPixels, h = metrics.heightPixels;

    Glide.with(image.getContext())
            .load(drawableId)
            .animate(ANIMATOR)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .into(new GlideDrawableImageViewTarget(image) {
                @Override
                public void getSize(final SizeReadyCallback cb) {
                    // We don't want to load very big images on devices with small screens.
                    // This will help Glide correctly choose images scale when reading them.
                    super.getSize(new SizeReadyCallback() {
                        @Override
                        public void onSizeReady(int width, int height) {
                            cb.onSizeReady(w / 2, h / 2);
                        }
                    });
                }
            });
}
项目:MyTouchGallery    文件:PictureSlideFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v=inflater.inflate(R.layout.fragment_picture_slide,container,false);

    imageView= (ImageView) v.findViewById(R.id.iv_main_pic);
    mAttacher = new PhotoViewAttacher(imageView);

    Glide.with(getActivity()).load(url).crossFade().into(new GlideDrawableImageViewTarget(imageView) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
            super.onResourceReady(resource, animation);
            mAttacher.update();
        }
    });
    return v;
}
项目:Anecdote    文件:ImageViewHolder.java   
/**
 * Load the image in the view
 */
private void loadImage(){
    if(TextUtils.isEmpty(mImageUrl)){
        return;
    }

    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(mImageView);

    Glide.with(mImageView.getContext())
            .load(mImageUrl)
            .listener(this)
            .error(R.drawable.ic_error_white_24dp)
            .into(imageViewTarget);

    mImageView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            MediaContextDialog.openDialog(mImageView.getContext(), mWebsiteName, mCurrentAnecdote, mImageUrl, mImageView);
            return true;
        }
    });
}
项目:glide-support    文件:DetailFragment.java   
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final ListItem model = (ListItem)getArguments().getSerializable("model");
    Glide
            .with(this)
            .using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
            .load(model.getStandardUrl())
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new GlideDrawableImageViewTarget(imageView) {
                @Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    Glide
                            .with(DetailFragment.this)
                            .using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
                            .load(model.getLowUrl())
                            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                            .error(R.drawable.glide_error)
                            .listener(new LoggingListener<String, GlideDrawable>())
                            .into(imageView);
                }
            });
}
项目:glide-support    文件:ListFragment.java   
private void bind(final ListItem model) {
    bound = model;
    Glide
            .with(itemView.getContext())
            .load(model.getLowUrl())
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new GlideDrawableImageViewTarget(image) {
                @Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    Glide
                            .with(itemView.getContext())
                            .load(model.getThumbUrl())
                            .error(R.drawable.glide_error)
                            .listener(new LoggingListener<String, GlideDrawable>())
                            .into(image);
                }
            });
}
项目:glide-support    文件:TestFragment_Single.java   
@Override protected void load(final Context context) throws Exception {
    String url = "http://www.kizoa.com/img/e8nZC.gif";
    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.github_1261_nine_to_five);
    if (drawable instanceof Animatable) {
        ((Animatable)drawable).stop();
        ((Animatable)drawable).start();
    }
    Glide
            .with(this)
            .load(url)
            .placeholder(drawable)
            .crossFade(3000)
            .skipMemoryCache(true) // make sure the image is reloaded so the placeholder has a chance
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .bitmapTransform(DelayTransformation.<Bitmap>create(2000)) // debug lengthen decode to see placeholder
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new LoggingTarget<>(new GlideDrawableImageViewTarget(imageView)))
    ;
}
项目:GankIO    文件:PhotoActivity.java   
private void initPhoto() {
    final ProgressBar progressBar = (ProgressBar) findViewById(R.id.photo_progressBar);
    progressBar.setVisibility(View.VISIBLE);

    ImageView img = (ImageView) findViewById(R.id.photo_img);
    Glide.with(this)
            .load(url)
            .dontAnimate()
            .fitCenter()
            .into(new GlideDrawableImageViewTarget(img) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    progressBar.setVisibility(View.GONE);
                }
            });
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainViewShotWithPlaceholderAndListener(Context context, ImageView placeholderView,
                                                              ImageView targetView, ShotImage shot,
                                                              RequestListener<String, GlideDrawable> requestListener) {
    Glide.clear(targetView);
    String imageUrl = getImageUrl(shot);

    Glide.clear(placeholderView);
    placeholderView.setVisibility(View.GONE);

    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(targetView);
    Glide.with(context)
            .load(imageUrl)
            .listener(requestListener)
            .placeholder(R.drawable.shot_placeholder)
            .thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
            .animate(android.R.anim.fade_in)
            .into(imageViewTarget);

}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainShotWithGifAnimation(Context context, ImageView placeholderView,
                                                ImageView targetView, ShotImage shot,
                                                AnimationDrawable animationDrawable) {
    placeholderView.setVisibility(View.VISIBLE);
    targetView.setVisibility(View.GONE);

    final String imageUrl = getImageUrl(shot);
    Glide.clear(placeholderView);
    Glide.clear(targetView);

    animationDrawable.start();

    Glide.with(context)
            .load(imageUrl)
            .listener(createRequestListener(placeholderView, targetView, animationDrawable))
            .error(R.drawable.logo_empty)
            .dontAnimate()
            .override(targetView.getMaxWidth(), targetView.getMaxHeight())
            .into(new GlideDrawableImageViewTarget(targetView));
}
项目:Silence    文件:ZoomingImageView.java   
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {
  subsamplingImageView.setVisibility(View.GONE);
  imageView.setVisibility(View.VISIBLE);

  Glide.with(getContext())
       .load(new DecryptableUri(masterSecret, uri))
       .diskCacheStrategy(DiskCacheStrategy.NONE)
       .dontTransform()
       .dontAnimate()
       .into(new GlideDrawableImageViewTarget(imageView) {
         @Override protected void setResource(GlideDrawable resource) {
           super.setResource(resource);
           imageViewAttacher.update();
         }
       });
}
项目:androidtestdebug    文件:AddNoteFragment.java   
@Override
public void showImagePreview(@NonNull String imageUrl) {
    checkState(!TextUtils.isEmpty(imageUrl), "imageUrl cannot be null or empty!");
    mImageThumbnail.setVisibility(View.VISIBLE);

    // The image is loaded in a different thread so in order to UI-test this, an idling resource
    // is used to specify when the app is idle.
    EspressoIdlingResource.increment(); // App is busy until further notice.

    // This app uses Glide for image loading
    Glide.with(this)
            .load(imageUrl)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .centerCrop()
            .into(new GlideDrawableImageViewTarget(mImageThumbnail) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    EspressoIdlingResource.decrement(); // Set app as idle.
                }
            });
}
项目:androidtestdebug    文件:NoteDetailFragment.java   
@Override
public void showImage(String imageUrl) {
    // The image is loaded in a different thread so in order to UI-test this, an idling resource
    // is used to specify when the app is idle.
    EspressoIdlingResource.increment(); // App is busy until further notice.

    mDetailImage.setVisibility(View.VISIBLE);

    // This app uses Glide for image loading
    Glide.with(this)
            .load(imageUrl)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .centerCrop()
            .into(new GlideDrawableImageViewTarget(mDetailImage) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    EspressoIdlingResource.decrement(); // App is idle.
                }
            });
}
项目:androidtestdebug    文件:AddNoteFragment.java   
@Override
public void showImagePreview(@NonNull String imageUrl) {
    checkState(!TextUtils.isEmpty(imageUrl), "imageUrl cannot be null or empty!");
    mImageThumbnail.setVisibility(View.VISIBLE);

    // The image is loaded in a different thread so in order to UI-test this, an idling resource
    // is used to specify when the app is idle.
    EspressoIdlingResource.increment(); // App is busy until further notice.

    // This app uses Glide for image loading
    Glide.with(this)
            .load(imageUrl)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .centerCrop()
            .into(new GlideDrawableImageViewTarget(mImageThumbnail) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    EspressoIdlingResource.decrement(); // Set app as idle.
                }
            });
}
项目:androidtestdebug    文件:NoteDetailFragment.java   
@Override
public void showImage(String imageUrl) {
    // The image is loaded in a different thread so in order to UI-test this, an idling resource
    // is used to specify when the app is idle.
    EspressoIdlingResource.increment(); // App is busy until further notice.

    mDetailImage.setVisibility(View.VISIBLE);

    // This app uses Glide for image loading
    Glide.with(this)
            .load(imageUrl)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .centerCrop()
            .into(new GlideDrawableImageViewTarget(mDetailImage) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    EspressoIdlingResource.decrement(); // App is idle.
                }
            });
}
项目:YiZhi    文件:ImageBrowseActivity.java   
/**
 * 加载静态图片
 */
private void loadImage() {
    Glide.with(ImageBrowseActivity.this)
            .load(mImageUrl)
            .fitCenter()
            .crossFade()
            .into(new GlideDrawableImageViewTarget(pvPic) {
                @Override
                public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) {
                    super.onResourceReady(drawable, anim);
                    //在这里添加一些图片加载完成的操作
                    pbPicBrowse.setVisibility(View.GONE);
                }
            });
}
项目:tenor-android-core    文件:GlideLoader.java   
public static <T extends ImageView> void load(@NonNull final GenericRequestBuilder requestBuilder,
                                              @NonNull final GlideTaskParams<T> payload) {

    if (payload.isThumbnail()) {
        requestBuilder.thumbnail(payload.getThumbnailMultiplier());
    }

    requestBuilder.placeholder(payload.getPlaceholder())
            .into(new GlideDrawableImageViewTarget(payload.getTarget()) {
                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    if (payload.getCurrentRetry() < payload.getMaxRetry()) {
                        payload.incrementCurrentRetry();
                        load(requestBuilder, payload);
                    } else {
                        super.onLoadFailed(e, errorDrawable);
                        payload.getListener().failure(payload.getTarget(), errorDrawable);
                    }
                }

                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    payload.getListener().success(payload.getTarget(), resource);
                }
            });
}
项目:item-reaper    文件:EditItemFragment.java   
@Override
public void showImage(@NonNull final String imageUrl) {
    mImageUrl = imageUrl;
    mItemImage.setVisibility(View.VISIBLE);
    mRemoveImageButton.setVisibility(View.VISIBLE);
    EspressoIdlingResource.increment();
    Glide.with(this)
            .load(mImageUrl)
            .crossFade()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(new GlideDrawableImageViewTarget(mItemImage) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    if (!EspressoIdlingResource.getIdlingResource().isIdleNow()) {
                        EspressoIdlingResource.decrement();
                    }
                }
            });
    if (mImageViewListener) {
        mPresenter.itemChanged();
    }
    if (!mImageUrl.startsWith("https://firebasestorage")
            && !mImageUrl.startsWith("file:///android_asset/black-t-shirt.jpg")) {
        Intent imageUploadIntent = new Intent(getContext(), ImageUploadService.class);
        imageUploadIntent.setAction(ACTION_UPLOAD_IMAGE);
        imageUploadIntent.putExtra(EXTRA_ITEM, createCurrentItem());
        getActivity().startService(imageUploadIntent);
    }
}
项目:item-reaper    文件:ItemsFragment.java   
@Override
        public void onBindViewHolder(ViewHolder holder, int position) {
            if (mLargeScreen) {
                String imageUrl = mItems.get(position).getImageUrl();
                if (imageUrl != null) {
                    if (!imageUrl.equals(mImageUrl)) {
                        mImageUrl = imageUrl;
                    }
                    holder.mItemImage.setVisibility(View.VISIBLE);
//                    EspressoIdlingResource.increment();
                    Glide.with(getContext())
                            .load(imageUrl)
                            .crossFade()
                            .centerCrop()
                            .diskCacheStrategy(DiskCacheStrategy.ALL)
                            .into(new GlideDrawableImageViewTarget(holder.mItemImage) {
                                @Override
                                public void onResourceReady(GlideDrawable resource,
                                                            GlideAnimation<? super GlideDrawable> animation) {
                                    super.onResourceReady(resource, animation);
//                                    EspressoIdlingResource.decrement();
                                }
                            });

                } else {
                    holder.mItemImage.setVisibility(View.GONE);
                }
            }
            String category = mItems.get(position).getCategory();
            if (category == null || category.equals("")) {
                holder.mCategory.setText(getString(R.string.edit_category_empty));
            } else {
                holder.mCategory.setText(category);
            }
            String type = mItems.get(position).getType();
            if (type == null || type.equals("")) {
                holder.mType.setText(getString(R.string.edit_type_empty));
            } else {
                holder.mType.setText(mItems.get(position).getType());
            }
            String colour = mItems.get(position).getMainColour();
            if (colour == null || colour.equals("")) {
                holder.mColour.setText(getString(R.string.edit_main_colour_empty));
            } else {
                holder.mColour.setText(mItems.get(position).getMainColour());
            }
            long expiry = mItems.get(position).getExpiry();
            if (expiry == -1) {
                setTextColourPrimary(holder);
                holder.mExpiry.setText(getString(R.string.edit_expiry_date_empty));
            } else {
                Calendar expiryDate = Calendar.getInstance();
                expiryDate.setTimeInMillis(expiry);
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(getString(
                        R.string.edit_date_format), Locale.ENGLISH);
                String expiryString = simpleDateFormat.format(expiryDate.getTime());
                holder.mExpiry.setText(expiryString);
                Calendar almostExpiredDate = Calendar.getInstance();
                almostExpiredDate.add(Calendar.MONTH, 1);
                if (expiryDate.compareTo(Calendar.getInstance()) < 1) {
                    holder.mExpiry.setTextColor(ContextCompat.getColor(getContext(), R.color.red));
                } else if (expiryDate.compareTo(almostExpiredDate) < 1) {
                    holder.mExpiry.setTextColor(ContextCompat.getColor(getContext(), R.color.orange));
                } else {
                    setTextColourPrimary(holder);
                }
            }
            int price = mItems.get(position).getPricePaid();
            String priceString;
            if (price == -1) {
                priceString = getString(R.string.edit_price_paid_empty);
            } else {
                priceString = getString(R.string.edit_price_paid_prefix)
                        + getPriceFromTotalCents(price);
            }
            holder.mPaid.setText(priceString);
        }
项目:droidfan    文件:DetailFragment.java   
@Override
    public void showPhoto(String url) {
//        Picasso.with(getContext()).load(url).into(mPhoto);
        Glide.with(getContext()).load(url).into(new GlideDrawableImageViewTarget(mPhoto){
            //应该是要由个gif的placeholder的 显示正在努力加载
            @Override
            public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                super.onResourceReady(resource, animation);
                mPhoto.setVisibility(View.VISIBLE);
            }
        });
    }
项目:Bagels    文件:BagelImageView.java   
public void setBagel(Bagel bagel) {
    this.bagel = bagel;
    handler = new Handler();
    runnable = new Runnable() {
        @Override
        public void run() {
            setBlurred(false);
        }
    };

    Glide.with(getContext()).load(BagelImageView.this.bagel.location).centerCrop().into(new GlideDrawableImageViewTarget(this) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
            super.onResourceReady(resource, animation);
            drawable = resource;

            new Thread() {
                @Override
                public void run() {
                    final Bitmap bitmap = ImageUtils.blurBitmap(getContext(), ImageUtils.drawableToBitmap(drawable));
                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        @Override
                        public void run() {
                            if (bitmap != null) {
                                blurredDrawable = new BitmapDrawable(getResources(), bitmap);
                                handler.postDelayed(runnable, 5000);
                            }
                        }
                    });
                }
            }.start();
        }
    });
}
项目:AndroidSamples    文件:GlideActivity.java   
@OnClick(R.id.glide_btn)
    public void onViewClicked() {
        LogUtils.i("onViewClicked: " + "加载图片");
        // 图片url(来自必应)
//      String url = "http://cn.bing.com/az/hprichbg/rb/Dongdaemun_ZH-CN10736487148_1920x1080.jpg";
        String url = "http://p1.pstatp.com/large/166200019850062839d3";
//      String url = "http://12345";
        Glide
                // 创建一个加载图片的实例
                .with(this)
                // 指定待加载的图片资源(网络图片、本地图片、应用资源、二进制流、Uri对象等等)
                .load(url)
                // 指定以图片形式显示(默认自动识别)
                // .asBitmap()
                // 指定以gif图片显示
                // .asGif()
                // 添加占位图
                .placeholder(R.drawable.img_tm)
                // 异常占位图
                .error(R.mipmap.ic_launcher)
                // 淡入加载效果
                .crossFade()
                // 自定义动画效果
                // .animate()
                // 图片加载优先级,越高越先加载
                .priority(Priority.HIGH)
                // 设置图片大小(以像素为单位)
                // .override(100, 100)
                // 设置缓存策略
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                // .into(glid1Img); // 让图片显示在哪个ImageView上
                // 带有监听得into方法
                .into(new GlideDrawableImageViewTarget(mGlideImg) {
                    @Override
                    public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                        super.onResourceReady(resource, animation);
                        LogUtils.i("onResourceReady: " + "图片加载完成");
                    }
                });
    }
项目:glide-support    文件:TestFragment_List.java   
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    listView.setLayoutManager(new GridLayoutManager(null, 2));
    String[] urls = new String[40];
    Arrays.fill(urls, "http://www.kizoa.com/img/e8nZC.gif");
    listView.setAdapter(new SimpleUrlAdapter(Glide.with(this), Arrays.asList(urls)) {
        @Override protected void load(Context context, RequestManager glide, String url, ImageView imageView)
                throws Exception {
            Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.github_1261_nine_to_five);
            if (drawable instanceof Animatable) {
                ((Animatable)drawable).stop(); // required in case the drawable was reused
                ((Animatable)drawable).start(); // required to start the animation
            }
            glide
                    .load(url)
                    .placeholder(drawable)
                    .crossFade(3000)
                    .skipMemoryCache(true) // debug: make sure the image is reloaded so the placeholder has a chance
                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                    // debug: lengthen loading to see placeholder
                    .bitmapTransform(DelayTransformation.<Bitmap>create(2000))
                    .listener(new LoggingListener<String, GlideDrawable>())
                    .into(new LoggingTarget<>(new GlideDrawableImageViewTarget(imageView)))
            ;
        }
    });
}
项目:glide-support    文件:TestFragment.java   
@Override protected void load(Context context) throws Exception {
    String url =
            "https://capfor.files.wordpress.com/2012/07/beautiful-forest-beautiful-day-forests-grass-green-light-nature-sunshine-trees.jpg";
    imageView.setBackgroundColor(Color.RED);
    Glide
            .with(getContext())
            .load(url)
            .skipMemoryCache(true)
            .centerCrop()
            .thumbnail(Glide
                    .with(getContext())
                    .load(url)
                    .skipMemoryCache(true)
                    .centerCrop()
                    .sizeMultiplier(.1f)
                    .crossFade(0) // dontAnimate doesn't work here, see GRB.buildRequestRecursive
            )
            .placeholder(new ColorDrawable(Color.BLUE))
            .crossFade(5000)
            .into(new GlideDrawableImageViewTarget(imageView) {
                @Override public void setDrawable(Drawable drawable) {
                    if (drawable instanceof TransitionDrawable) {
                        //((TransitionDrawable)drawable).setCrossFadeEnabled(false);
                    }
                    super.setDrawable(drawable);
                }
            });
}
项目:glide-support    文件:TestFragment.java   
@Override protected void load1(Context context, ImageView imageView) throws Exception {
    Glide
            .with(this)
            // default timeout is 2.5 seconds (com.bumptech.glide.load.data.HttpUrlFetcher)
            .load("https://httpbin.org/delay/12") // force a timeout: 2.5 < 12
            .signature(new StringSignature("load1")) // distinguish from other load to make sure loader is picked up
            .placeholder(R.drawable.glide_placeholder)
            .error(R.drawable.glide_error)
            .listener(new LoggingListener<String, GlideDrawable>("load1"))
            .into(new LoggingTarget<>("load1", Log.VERBOSE, new GlideDrawableImageViewTarget(imageView)))
    ;
}
项目:glide-support    文件:TestFragment.java   
@Override protected void load2(Context context, ImageView imageView) throws Exception {
    Glide
            .with(this)
            .using(new StreamModelLoaderWrapper<>(new OkHttpUrlLoader(longTimeoutClient)))
            .load(new GlideUrl("https://httpbin.org/delay/12")) // timeout increased: 15 > 10, so it'll pass
            .signature(new StringSignature("load2")) // distinguish from other load to make sure loader is picked up
            .placeholder(R.drawable.glide_placeholder)
            // since the test URL returns a JSON stream, the load will fail,
            // let's still add an error to see that the load fails slower than the other,
            // meaning the image was actually tried to be decoded
            .error(R.drawable.glide_error)
            .listener(new LoggingListener<GlideUrl, GlideDrawable>("load2"))
            .into(new LoggingTarget<>("load2", Log.VERBOSE, new GlideDrawableImageViewTarget(imageView)))
    ;
}
项目:glide-support    文件:QuickFragment.java   
@Override protected void load(final Context context) throws Exception {
    String url = "http://i.imgur.com/1ALnB2s.gif";
    Glide
            .with(this)
            .load(url)
            .placeholder(R.drawable.glide_placeholder)
            .animate(android.R.anim.fade_in)
            .error(R.drawable.glide_error)
            .fallback(R.drawable.glide_fallback)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .skipMemoryCache(true)
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new LoggingTarget<>(new GlideDrawableImageViewTarget(imageView)))
    ;
}
项目:glide-support    文件:TestFragment_Pre380.java   
@Override protected void load(Context context) throws Exception {
    Glide
            .with(context)
            .load(R.drawable.glide)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .fitCenter()
            .placeholder(R.drawable.glide_placeholder)
            .crossFade(2000)
            .into(new GlideDrawableImageViewTarget(imageView) {
                @Override public void onResourceReady(GlideDrawable resource,
                        GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, new PaddingAnimation<>(animation));
                }
            });
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainViewShot(Context context, ImageView targetView, ShotImage shot) {
    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(targetView);
    Glide.with(context)
            .load(getImageUrl(shot))
            .placeholder(R.drawable.shot_placeholder)
            .thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
            .animate(android.R.anim.fade_in)
            .into(imageViewTarget);
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainViewShotNoPlaceholder(Context context,
                                                 ImageView target,
                                                 ShotImage shot) {

    String imageUrl = getImageUrl(shot);
    Timber.d("shot image url: %s", imageUrl);
    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(target);
    Glide.with(context)
            .load(imageUrl)
            .animate(android.R.anim.fade_in)
            .into(imageViewTarget);
}
项目:Easy_xkcd    文件:FavoritesFragment.java   
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    View itemView = setupPager(container, position);
    final PhotoView pvComic = (PhotoView) itemView.findViewById(R.id.ivComic);
    final TextView tvAlt = (TextView) itemView.findViewById(R.id.tvAlt);
    final TextView tvTitle = (TextView) itemView.findViewById(R.id.tvTitle);

    tvAlt.setText(prefHelper.getAlt(favorites[position]));
    tvTitle.setText(Html.fromHtml(prefHelper.getTitle(favorites[position])));

    if (getGifId(favorites[position] - 1) != 0)
        Glide.with(getActivity())
                .load(getGifId(favorites[position] - 1))
                .into(new GlideDrawableImageViewTarget(pvComic));
    else {
        Bitmap bitmap = ((OfflineComic) comicMap.get(position)).getBitmap();
        if (themePrefs.invertColors(false) && themePrefs.bitmapContainsColor(bitmap, position+1))
            pvComic.clearColorFilter();
        if (bitmap != null)
            pvComic.setImageBitmap(bitmap);
        else
            new RedownloadFavorite().execute(comicMap.get(position).getComicNumber()); // If the image is gone download it and refresh the fragment
    }
    if (Arrays.binarySearch(mContext.getResources().getIntArray(R.array.large_comics), favorites[favoriteIndex]) >= 0)
        pvComic.setMaximumScale(13.0f);

    container.addView(itemView);
    return itemView;
}
项目:stepik-android    文件:CourseDetailFragment.java   
private void initHeader(LayoutInflater layoutInflater) {
    header = layoutInflater.inflate(R.layout.fragment_course_detailed_header, coursePropertyListView, false);
    coursePropertyListView.addHeaderView(header);

    courseIcon = header.findViewById(R.id.courseIcon);
    joinCourseView = header.findViewById(R.id.join_course_layout);
    continueCourseView = header.findViewById(R.id.go_to_learn);
    thumbnail = header.findViewById(R.id.playerThumbnail);
    player = header.findViewById(R.id.playerLayout);
    courseTargetFigSupported = new GlideDrawableImageViewTarget(courseIcon);
    player.setVisibility(View.GONE);
    courseNameView = header.findViewById(R.id.course_name);
}
项目:stepik-android    文件:SectionsFragment.java   
@Override
public void onViewCreated(View view, @android.support.annotation.Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    imageViewTarget = new GlideDrawableImageViewTarget(courseIcon);
    hideSoftKeypad();
    firstLoad = true;

    swipeRefreshLayout.setOnRefreshListener(this);

    sectionsRecyclerView.setVisibility(View.GONE);
    linearLayoutManager = new LinearLayoutManager(getActivity());
    sectionsRecyclerView.setLayoutManager(linearLayoutManager);
    sectionList = new ArrayList<>();
    adapter = new SectionAdapter(downloadingPresenter, sectionList, ((AppCompatActivity) getActivity()), calendarPresenter, sectionsPresenter.getProgressMap(), sectionIdToLoadingStateMap, this, downloadingInteractionPresenter);
    sectionsRecyclerView.setAdapter(adapter);

    sectionsRecyclerView.setItemAnimator(new SlideInRightAnimator());
    sectionsRecyclerView.getItemAnimator().setRemoveDuration(ANIMATION_DURATION);
    sectionsRecyclerView.getItemAnimator().setAddDuration(ANIMATION_DURATION);
    sectionsRecyclerView.getItemAnimator().setMoveDuration(ANIMATION_DURATION);
    sectionsRecyclerView.getItemAnimator().setChangeDuration(0);


    joinCourseProgressDialog = new LoadingProgressDialog(getContext());
    ProgressHelper.activate(loadOnCenterProgressBar);
    storeStateManager.addSectionCallback(this);
    localProgressManager.subscribe(this);
    droppingListenerClient.subscribe(this);
    calendarPresenter.attachView(this);
    courseFinderPresenter.attachView(this);
    courseJoinerPresenter.attachView(this);
    sectionsPresenter.attachView(this);
    invitationPresenter.attachView(this);
    downloadingPresenter.attachView(this);

    ToolbarHelperKt.initCenteredToolbar(this, R.string.syllabus_title, true);
    onNewIntent(getActivity().getIntent());
}