INNER CODE UNIT · Kotlin

cropImage

FossifyOrg/Gallery · app/src/main/kotlin/org/fossify/gallery/activities/BaseCropActivity.kt:27

    protected fun cropImage() {
        setCropProgressBarVisibility(true)
        bitmapCroppingJob?.cancel()
        bitmapCroppingJob = lifecycleScope.launch(CoroutineExceptionHandler { _, t ->
            onImageCropped(bitmap = null, error = Exception(t))
        }) {
            val bitmap = withContext(Dispatchers.Default) {
                cropImageView.getCroppedImage()
            }
            onImageCropped(bitmap, null)
        }.apply {
            lifecycleScope.launch(Dispatchers.Main) {
                setCropProgressBarVisibility(false)
            }
        }
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…