Search in sources :

Example 1 with GlideDrawableImageViewTarget

use of com.bumptech.glide.request.target.GlideDrawableImageViewTarget in project Signal-Android by WhisperSystems.

the class ZoomingImageView method setImageViewUri.

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();
        }
    });
}
Also used : GlideDrawableImageViewTarget(com.bumptech.glide.request.target.GlideDrawableImageViewTarget) DecryptableUri(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Example 2 with GlideDrawableImageViewTarget

use of com.bumptech.glide.request.target.GlideDrawableImageViewTarget in project Pix-Art-Messenger by kriztan.

the class ShowFullscreenMessageActivity method DisplayImage.

private void DisplayImage(final File file) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(new File(file.getPath()).getAbsolutePath(), options);
    height = options.outHeight;
    width = options.outWidth;
    rotation = getRotation(Uri.parse("file://" + file.getAbsolutePath()));
    Log.d(Config.LOGTAG, "Image height: " + height + ", width: " + width + ", rotation: " + rotation);
    if (useAutoRotateScreen()) {
        rotateScreen(width, height, rotation);
    }
    final PhotoViewAttacher mAttacher = new PhotoViewAttacher(mImage);
    mImage.setVisibility(View.VISIBLE);
    try {
        Glide.with(this).load(file).dontAnimate().into(new GlideDrawableImageViewTarget(mImage) {

            @Override
            public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                super.onResourceReady(resource, animation);
                mAttacher.update();
            }
        });
    } catch (Exception e) {
        Toast.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show();
        e.printStackTrace();
    }
}
Also used : GlideDrawableImageViewTarget(com.bumptech.glide.request.target.GlideDrawableImageViewTarget) BitmapFactory(android.graphics.BitmapFactory) File(java.io.File) PhotoViewAttacher(com.github.chrisbanes.photoview.PhotoViewAttacher) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) ActivityNotFoundException(android.content.ActivityNotFoundException) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Aggregations

GlideDrawable (com.bumptech.glide.load.resource.drawable.GlideDrawable)2 GlideDrawableImageViewTarget (com.bumptech.glide.request.target.GlideDrawableImageViewTarget)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 BitmapFactory (android.graphics.BitmapFactory)1 PhotoViewAttacher (com.github.chrisbanes.photoview.PhotoViewAttacher)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 DecryptableUri (org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri)1