mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 16:00:02 +00:00
committed by
Moxie Marlinspike
parent
37fbd769b7
commit
f1137927d4
@@ -0,0 +1,45 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.BitmapImageViewTarget;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
|
||||
import uk.co.senab.photoview.PhotoViewAttacher;
|
||||
|
||||
public class ZoomingImageView extends ImageView {
|
||||
private PhotoViewAttacher attacher = new PhotoViewAttacher(this);
|
||||
|
||||
public ZoomingImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ZoomingImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public ZoomingImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void setImageUri(MasterSecret masterSecret, Uri uri) {
|
||||
Glide.with(getContext())
|
||||
.load(new DecryptableUri(masterSecret, uri))
|
||||
.asBitmap()
|
||||
.dontTransform()
|
||||
.dontAnimate()
|
||||
.into(new BitmapImageViewTarget(this) {
|
||||
@Override protected void setResource(Bitmap resource) {
|
||||
super.setResource(resource);
|
||||
attacher.update();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user