CanHub / Android-Image-Cropper

Image Cropping Library for Android, optimised for Camera / Gallery.
https://canhub.github.io/
Apache License 2.0
1.17k stars 240 forks source link

How to customize the AlertDialog in Jetpack Compose? #625

Closed Vedant0-0 closed 2 months ago

Vedant0-0 commented 2 months ago
internal class CustomImagePicker : CropImageActivity() {

    companion object {
        fun start(activity: Activity) {
            ActivityCompat.startActivity(
                activity,
                Intent(activity, CustomImagePicker::class.java),
                null
            )
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)

    }

    @Composable
    @OptIn(ExperimentalMaterial3Api::class)
    override fun showImageSourceDialog(openSource: (Source) -> Unit) {
        val bottomSheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden)

        ModalBottomSheet(
            sheetState = bottomSheetState,
            onDismissRequest = { bottomSheetState.hide() }
        ) {
            // My Content
        }
    }
}

I want to show a ModalBottomSheet instead of an Alert Dialog.

@Composable annotation mismatch with overridden function: @Composable @OptIn public open fun showImageSourceDialog(openSource: (CropImageActivity.Source) -> Unit): Unit defined in com.melonfeed.melonfeed.CustomImagePicker, public open fun showImageSourceDialog(openSource: (CropImageActivity.Source) -> Unit): Unit defined in com.canhub.cropper.CropImageActivity

This error I'm getting. What should I do?

vanniktech commented 2 months ago

This is not stackoverflow.

Vedant0-0 commented 2 months ago

@vanniktech I'm not being rude but the docs of CanHub are not pretty clear. And also I don't think I should ask it on stackoverflow as it's an issue with docs (docs are not clear). This library can be used in Jetpack Compose but you docs never mention about it.

BTW Thanks for the reply.

vanniktech commented 2 months ago

This library can be used in Jetpack Compose but you docs never mention about it.

Just because it can be used, does not mean it's officially supported and the lack of documentation is a probably a reason for it.