I've got my CWAC Camera fragment setup, and everything is working nicely. There's a few customizations I'd like to do.
- I'd like to show a ProgressBar as the camera fragment is loading into it's host Activity/Fragment
- After a user has taken a picture, I want to show a ProgressBar again overlay on the picture taking button, so they understand they can't immediately take a picture until the camera is ready again
From looking into the documentation for CWAC Camera, I haven't found anything that supports this sort of callback. Is this sort of thing even possible to listen for? If so, does the library have an easy way to do it that I'm not seeing?
Thanks in advance for all your help.
I have no idea what "loading into the Activity/Fragment" means.
You know when you are calling
takePicture()
. You can know whensaveImage()
is called on yourCameraHost
by creating your own implementation ofCameraHost
or own subclass ofSimpleCameraHost
. You can do yourProgressBar
work at those times. You can see this in the demo app, where I disable and re-enable the action bar item for the same purpose.To be notified when the camera is loaded and preview started, use this code:
I used this code to update the UI, so that flash button only appears when camera supported:
return non-null List and size > 0. Usually Front Facing Camera has no flash but who knows?
If you want to switch camera, please also see my other answer here: CWAC Camera - Multiple camera views in one layout (and switching between them)