use of uk.co.senab.photoview.PhotoViewAttacher in project GeekNews by codeestX.
the class GirlDetailActivity method initEventAndData.
@Override
protected void initEventAndData() {
setToolBar(toolBar, "");
mRealmHelper = App.getAppComponent().realmHelper();
Intent intent = getIntent();
url = intent.getExtras().getString("url");
id = intent.getExtras().getString("id");
if (url != null) {
Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
bitmap = resource;
ivGirlDetail.setImageBitmap(resource);
mAttacher = new PhotoViewAttacher(ivGirlDetail);
}
});
}
}
use of uk.co.senab.photoview.PhotoViewAttacher in project WordPress-Android by wordpress-mobile.
the class PhotoChooserPreviewActivity method loadImage.
private void loadImage() {
// load a scaled version of the image to prevent OOM exception
int maxWidth = DisplayUtils.getDisplayPixelWidth(this);
byte[] bytes = ImageUtils.createThumbnailFromUri(this, mMediaUri, maxWidth, null, 0);
if (bytes == null) {
ToastUtils.showToast(this, R.string.error_media_load);
delayedFinish();
return;
}
Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
if (bmp == null) {
ToastUtils.showToast(this, R.string.error_media_load);
delayedFinish();
return;
}
mImageView.setImageBitmap(bmp);
// attach the photo zoomer
PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float v, float v2) {
finish();
}
});
attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float v, float v2) {
finish();
}
});
}
use of uk.co.senab.photoview.PhotoViewAttacher in project WordPress-Android by wordpress-mobile.
the class ReaderPhotoView method setAttacher.
private void setAttacher() {
PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float v, float v2) {
if (mPhotoViewListener != null) {
mPhotoViewListener.onTapPhotoView();
}
}
});
attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float v, float v2) {
if (mPhotoViewListener != null) {
mPhotoViewListener.onTapPhotoView();
}
}
});
}
use of uk.co.senab.photoview.PhotoViewAttacher in project boxing by Bilibili.
the class BoxingRawImageFragment method onViewCreated.
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mProgress = (ProgressBar) view.findViewById(R.id.loading);
mImageView = (PhotoView) view.findViewById(R.id.photo_view);
mAttacher = new PhotoViewAttacher(mImageView);
mAttacher.setRotatable(true);
mAttacher.setToRightAngle(true);
((AbsBoxingViewActivity) getActivity()).loadRawImage(mImageView, mMedia.getPath(), new BoxingCallback(this));
}
use of uk.co.senab.photoview.PhotoViewAttacher in project wh-app-android by WhiteHouse.
the class GalleryPhotoFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mPhotoDescription.setText(Html.fromHtml(prepDescription(mFeedItem.description())));
Picasso.with(view.getContext()).load(mFeedItem.getBestThumbnailUrl(1500)).into(mPhotoView, new Callback() {
@Override
public void onSuccess() {
mPhotoViewAttacher = new PhotoViewAttacher(mPhotoView) {
@Override
public boolean onTouch(View v, MotionEvent ev) {
switch(ev.getAction()) {
case MotionEvent.ACTION_DOWN:
mTouching = true;
decideDescriptionVisibility(getScale());
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mTouching = false;
decideDescriptionVisibility(getScale());
break;
}
return super.onTouch(v, ev);
}
};
mPhotoViewAttacher.setOnMatrixChangeListener(rectF -> {
decideDescriptionVisibility(mPhotoViewAttacher.getScale());
if (mPhotoViewAttacher.getScale() > 1.1f) {
mPhotoViewAttacher.setAllowParentInterceptOnEdge(false);
} else {
mPhotoViewAttacher.setAllowParentInterceptOnEdge(true);
}
});
}
@Override
public void onError() {
}
});
}
Aggregations