use of uk.co.senab.photoview.PhotoView in project PhotoNoter by yydcdut.
the class PhotoDetailPagerAdapter method instantiateItem.
@Override
public View instantiateItem(ViewGroup container, int position) {
final PhotoView photoView = new PhotoView(container.getContext());
ImageLoader.getInstance().displayImage("file:/" + mPhotoPathList.get(position), photoView);
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
photoView.setOnPhotoTapListener(this);
return photoView;
}
use of uk.co.senab.photoview.PhotoView in project ride-read-android by Ride-Read.
the class ImageFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View mview = inflater.inflate(R.layout.imagefragment, container, false);
photoView = (PhotoView) mview.findViewById(R.id.photoview);
Glide.with(this).load(imgUrl).thumbnail(0.5f).fitCenter().into(photoView);
return mview;
}
use of uk.co.senab.photoview.PhotoView in project GomoTest by suReZj.
the class viewPager_adapter method instantiateItem.
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
Glide.with(container.getContext()).load(list.get(position).getPath()).into(photoView);
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return photoView;
}
use of uk.co.senab.photoview.PhotoView in project SeaStar by 13120241790.
the class PreviewFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(io.rong.imkit.R.layout.rc_fr_photo2, container, false);
mPhotoView = (PhotoView) view.findViewById(io.rong.imkit.R.id.rc_icon);
initPhoto(uri);
return view;
}
use of uk.co.senab.photoview.PhotoView in project weiciyuan by qii.
the class GifPictureFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.gallery_gif_layout, container, false);
gifImageView = (PhotoView) view.findViewById(R.id.gif);
if (SettingUtility.allowClickToCloseGallery()) {
gifImageView.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
getActivity().onBackPressed();
}
});
}
LongClickListener longClickListener = ((ContainerFragment) getParentFragment()).getLongClickListener();
gifImageView.setOnLongClickListener(longClickListener);
String path = getArguments().getString("path");
boolean animateIn = getArguments().getBoolean("animationIn");
final AnimationRect rect = getArguments().getParcelable("rect");
File gifFile = new File(path);
try {
GifDrawable gifFromFile = new GifDrawable(gifFile);
gifImageView.setImageDrawable(gifFromFile);
} catch (IOException e) {
e.printStackTrace();
}
final ClipImageView photoView = (ClipImageView) view.findViewById(R.id.cover);
Bitmap bitmap = ImageUtility.decodeBitmapFromSDCard(path, IMAGEVIEW_SOFT_LAYER_MAX_WIDTH, IMAGEVIEW_SOFT_LAYER_MAX_HEIGHT);
photoView.setImageBitmap(bitmap);
if (!animateIn) {
photoView.setVisibility(View.INVISIBLE);
return view;
}
gifImageView.setVisibility(View.INVISIBLE);
final Runnable endAction = new Runnable() {
@Override
public void run() {
Bundle bundle = getArguments();
bundle.putBoolean("animationIn", false);
photoView.setVisibility(View.INVISIBLE);
gifImageView.setVisibility(View.VISIBLE);
}
};
photoView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (rect == null) {
photoView.getViewTreeObserver().removeOnPreDrawListener(this);
endAction.run();
return true;
}
final Rect startBounds = new Rect(rect.scaledBitmapRect);
final Rect finalBounds = AnimationUtility.getBitmapRectFromImageView(photoView);
if (finalBounds == null) {
photoView.getViewTreeObserver().removeOnPreDrawListener(this);
endAction.run();
return true;
}
float startScale = (float) finalBounds.width() / startBounds.width();
if (startScale * startBounds.height() > finalBounds.height()) {
startScale = (float) finalBounds.height() / startBounds.height();
}
int oriBitmapScaledWidth = (int) (finalBounds.width() / startScale);
int oriBitmapScaledHeight = (int) (finalBounds.height() / startScale);
int thumbnailAndOriDeltaRightSize = Math.abs(rect.scaledBitmapRect.width() - oriBitmapScaledWidth);
int thumbnailAndOriDeltaBottomSize = Math.abs(rect.scaledBitmapRect.height() - oriBitmapScaledHeight);
float thumbnailAndOriDeltaWidth = (float) thumbnailAndOriDeltaRightSize / (float) oriBitmapScaledWidth;
float thumbnailAndOriDeltaHeight = (float) thumbnailAndOriDeltaBottomSize / (float) oriBitmapScaledHeight;
int deltaTop = startBounds.top - finalBounds.top;
int deltaLeft = startBounds.left - finalBounds.left;
photoView.setPivotY((photoView.getHeight() - finalBounds.height()) / 2);
photoView.setPivotX((photoView.getWidth() - finalBounds.width()) / 2);
photoView.setScaleX(1 / startScale);
photoView.setScaleY(1 / startScale);
photoView.setTranslationX(deltaLeft);
photoView.setTranslationY(deltaTop);
photoView.animate().translationY(0).translationX(0).scaleY(1).scaleX(1).setDuration(ANIMATION_DURATION).setInterpolator(new AccelerateDecelerateInterpolator()).withEndAction(endAction);
if (rect.type == AnimationRect.TYPE_EXTEND_V || rect.type == AnimationRect.TYPE_EXTEND_H) {
AnimatorSet animationSet = new AnimatorSet();
animationSet.setDuration(ANIMATION_DURATION);
animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.playTogether(ObjectAnimator.ofFloat(photoView, "clipBottom", thumbnailAndOriDeltaHeight, 0));
animationSet.start();
} else {
AnimatorSet animationSet = new AnimatorSet();
animationSet.setDuration(ANIMATION_DURATION);
animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
float clipRectH = ((float) (oriBitmapScaledWidth - oriBitmapScaledWidth * thumbnailAndOriDeltaWidth - rect.widgetWidth) / 2) / (float) oriBitmapScaledWidth;
float clipRectV = ((float) (oriBitmapScaledHeight - oriBitmapScaledHeight * thumbnailAndOriDeltaHeight - rect.widgetHeight) / 2) / (float) oriBitmapScaledHeight;
animationSet.playTogether(ObjectAnimator.ofFloat(photoView, "clipHorizontal", clipRectH, 0));
animationSet.playTogether(ObjectAnimator.ofFloat(photoView, "clipVertical", clipRectV, 0));
animationSet.playTogether(ObjectAnimator.ofFloat(photoView, "clipBottom", thumbnailAndOriDeltaHeight, 0));
animationSet.playTogether(ObjectAnimator.ofFloat(photoView, "clipRight", thumbnailAndOriDeltaWidth, 0));
animationSet.start();
}
photoView.getViewTreeObserver().removeOnPreDrawListener(this);
return true;
}
});
return view;
}
Aggregations