Image Preview

There's cases when you want to image more clearly. Referencing from Tedis here.

Call this method:

previewImage(
    ctx = this, // (1)
    listImage = listOf( // (2)
        "urlImage1",
        "urlImage2",
        "urlImage3",
        "urlImage4",
        "urlImage5",
        "urlImage6",
    ),
    position = 0, // (3)
    loader = {image, url ->  // (4)
        (image as ImageView).setImageURI(url)
    },
    onDismiss = { 
        // (5)
    }
)
  1. Context for inflating ImageViewer
  2. List of image to open
  3. Index of the first image to display, default 0
  4. How to load the image
  5. Action when the preview is dismissed