use of com.github.chrisbanes.photoview.PhotoView in project Palm300Heroes by nicolite.
the class ShowImageAdapter method instantiateItem.
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
final PhotoView imageView = new PhotoView(context);
final PhotoViewAttacher attacher = new PhotoViewAttacher(imageView);
Glide.with(context).load(images.get(position)).placeholder(R.drawable.img_loading).error(R.drawable.img_error).skipMemoryCache(true).crossFade().centerCrop().into(new SimpleTarget<GlideDrawable>() {
@Override
public void onLoadStarted(Drawable placeholder) {
super.onLoadStarted(placeholder);
imageView.setImageDrawable(placeholder);
attacher.update();
}
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
imageView.setImageDrawable(resource);
attacher.update();
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
imageView.setImageDrawable(errorDrawable);
attacher.update();
}
});
container.addView(imageView);
return imageView;
}
use of com.github.chrisbanes.photoview.PhotoView in project ForPDA by RadiationX.
the class ImagesAdapter method loadImage.
private void loadImage(View imageLayout, int position) {
assert imageLayout != null;
CircularProgressView progressBar = (CircularProgressView) imageLayout.findViewById(R.id.progress_bar);
PhotoView photoView = (PhotoView) imageLayout.findViewById(R.id.photo_view);
if (crop)
photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (clickListener != null)
photoView.setOnClickListener(v -> clickListener.itemClick(v, position));
imageLoader.displayImage(urls.get(position), photoView, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
progressBar.setVisibility(View.GONE);
// delayedHide(1000);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingStarted(String imageUri, View view) {
progressBar.setVisibility(View.VISIBLE);
if (progressBar.isIndeterminate()) {
progressBar.setIndeterminate(false);
progressBar.stopAnimation();
}
}
}, (s, view, i, i1) -> progressBar.setProgress((int) (100F * i / i1)));
photoView.setOnPhotoTapListener(tapListener);
}
use of com.github.chrisbanes.photoview.PhotoView in project PhotoView by chrisbanes.
the class ImmersiveActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_immersive);
PhotoView photoView = findViewById(R.id.photo_view);
Picasso.with(this).load("http://pbs.twimg.com/media/Bist9mvIYAAeAyQ.jpg").into(photoView);
photoView.setOnPhotoTapListener(new OnPhotoTapListener() {
@Override
public void onPhotoTap(ImageView view, float x, float y) {
// fullScreen();
}
});
fullScreen();
}
use of com.github.chrisbanes.photoview.PhotoView in project PhotoView by chrisbanes.
the class PicassoSampleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple);
final PhotoView photoView = findViewById(R.id.iv_photo);
Picasso.with(this).load("https://images.unsplash.com/photo-1577643816920-65b43ba99fba?ixlib=rb-1.2.1&auto=format&fit=crop&w=3300&q=80").into(photoView);
}
use of com.github.chrisbanes.photoview.PhotoView in project CustomViews by AndroidStudy233.
the class ImagePreviewAdapter method destroyItem.
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
View view = (View) object;
final PhotoView imageView = view.findViewById(R.id.pv);
if (imageView != null) {
Drawable drawable = imageView.getDrawable();
if (drawable == null) {
drawable = imageView.getBackground();
}
if (drawable != null) {
drawable.setCallback(null);
}
}
container.removeView((View) object);
}
Aggregations