@SuppressLint("ClickableViewAccessibility") //this is due to Loupe hack
    public static void createZoomableImageView(final Activity activity, final ImageView imageView, final ViewGroup imageContainer,
                                               final Runnable onFlingUpDown, final Runnable onSingleTap) {
        final Loupe loupe = new Loupe(imageView, imageContainer);
        if (onFlingUpDown != null) {
            loupe.setOnViewTranslateListener(new Loupe.OnViewTranslateListener() {
                @Override
                public void onStart(@NonNull final ImageView imageView) {
                    //empty on purpose
                }

                @Override
                public void onViewTranslate(@NonNull final ImageView imageView, final float v) {
                    //empty on purpose
                }

                @Override
                public void onDismiss(@NonNull final ImageView imageView) {
                    //this method is called on "fling down" or "fling up"
                    onFlingUpDown.run();
                }

                @Override
                public void onRestore(@NonNull final ImageView imageView) {
                    //empty on purpose
                }
            });
        }

        if (onSingleTap != null) {
            //Loupe is unable to detect single clicks (see https://github.com/igreenwood/loupe/issues/25)
            //As a workaround we register a second GestureDetector on top of the one installed by Loupe to detect single taps
            //Workaround START
            final GestureDetector singleTapDetector = new GestureDetector(activity, new GestureDetector.SimpleOnGestureListener() {
                @Override
                public boolean onSingleTapConfirmed(@NonNull final MotionEvent e) {
                    //Logic to happen on single tap
                    onSingleTap.run();
                    return true;
                }
            });
            //Registering an own touch listener overrides the TouchListener registered by Loupe
            imageContainer.setOnTouchListener((v, event) -> {
                //perform singleTap detection
                singleTapDetector.onTouchEvent(event);
                //pass through event to Loupe so it handles all other gestures correctly
                return loupe.onTouch(v, event);
            });
        }
        //Workaround END
    }
transforms an ImageView in a zoomable, pinchable ImageView. This method uses Loupe under the hood
@param activity activity where the view resides in
@param imageView imageView to make zoomable/pinchable
@param imageContainer container around the imageView. See loupe doc for details
@param onFlingUpDown optional: action to happen on fling down or fling up
@param onSingleTap optiona: action to happen on single tap. Note that this action is registered / exceuted for whole activity
main/src/main/java/cgeo/geocaching/utils/ImageUtils.java