Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera state based control #67

Merged
merged 11 commits into from
Mar 11, 2024
Merged

Conversation

SuLG-ik
Copy link
Contributor

@SuLG-ik SuLG-ik commented Feb 29, 2024

Add PeekabooCameraState and PeekabooCamera that matches state flow.

Reason: old api with inner overlay has no abilities for advanced usage of camera.
For example, if i need to handle progress state outside of PeekabooCamera, i add external boolean state of is in progress and add disposable effect inside progressIndicator to change this state and handle it outside PeekabooCamera, for example, to change captureIcon.

var isCapturing by remember { mutableStateOf(false) }
PeekabooCamera(
    modifier = Modifier.fillMaxSize().padding(it),
    cameraMode = CameraMode.Back,
    progressIndicator = {
        DisposableEffect(Unit) {
            isCapturing = true
            onDispose { isCapturing = false }
        }
    },
   / * ... */
)

Benefits: camera overlay become more flexible and in future PeekabooCameraState will be able to have advanced features of camera control.

Note: camera underhood is not changes, only provide actions to new state api. Old api saved for compatibility, but underhood rebased on state

@SuLG-ik
Copy link
Contributor Author

SuLG-ik commented Mar 6, 2024

Fix for pass spotless check

@onseok
Copy link
Owner

onseok commented Mar 11, 2024

Thanks for your PR!
LGTM 👍

@onseok onseok merged commit fdc9c06 into onseok:main Mar 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants