- center the PreviewView between the top action icons and the bottom mode switcher view for 4:3, 3:2 (video mode - SD) and 1:1 resolutions, when not full screen
- add custom MediaActionSound, with functionality to notify callers when playing sound ends
- only start video recording when the sound has played completely
- debounce switching by 500ms when toggling between video/photo capture
- ensure there is only one source of truth for the current camera mode - this is the CameraXPreview
- refactor the MainActivity to depend on the CameraXPreview for the camera mode
- remove unused code in CameraXPreviewListener, MyPreview and in MainActivity
- debounce switching by 300ms when toggling between video/photo capture
- setCameraAvailable only when there is no error and the camera state is Type.OPEN
- instead of using the OnImageSavedCallback, we now use the OnImageCaptureCallback and we play the sound in the onCapturedSuccess method to prevent the user from hearing the capture sound before the actual capture takes place
- add ImageSaver and ImageUtil based on CameraX implementation
- add sealed interfaces ImageCaptureOutput and VideoCaptureOutput to prevent confusion on the supported output format for images and video
- ImageSaver supports saving images with all MediaOutput.ImageCaptureOutput that can be saved to disk; MediaStoreOutput, OutputStreamMediaOutput and FileMediaOutput (unused at the moment), it throws an UnsupportedOperation when trying to save a BitmapOutput.
- with ImageSaver, we now have control of whether the Exif attributes are written to disk and so we can get rid of ExifRemover
- delete the extension method ImageProxy.toJpegByteArray as we have a similar method in ImageUtils class
- adjust the preview so the image captured is what the user sees
- add method MySize.isSupported; current support is for full, 16:9, 4:3 and 1:1 of the highest resolution
- cleanup ImageQualityManager, add method to get the full screen resolution which is just the resolution with the largest width
- change the UI to move settings to the top and remove the auto fading
- set the preview scale type to fitStart
- both the preview and image capture would use the same size
- some other code cleanups to remove unused code / formatting changes
- add a new BitmapOutput, returned from the MediaOutputHelper when no output URI is specified in an IMAGE_CAPTURE intent
- in this format, take the picture without actually saving it and return the bitmap
- this behaviour is consistent with the implementation described in the official Android docs https://developer.android.com/training/camera/photobasics#TaskPhotoView
- CameraX video allowed predefined buckets of qualities UHD, FHD, HD, SD (defined in VideoQuality enum),
the CameraXPreview is configured to use the highest quality and
CameraX will select the closest corresponding resolution supported by the device.
- tentatively add ChangeResolutionDialogX (which would be renamed back to ChangeResolutionDialog) to give user option to select photo resolution and video qualities
- add ImageQualityManager which performs the same operation for getting all resolutions supported by a device using the Camera2 API, as defined in the legacy CameraPreview
- add VideoQualityManager to manage saving/ getting user selected quality.
- in MediaOutputHelper,
- add support for specifying the output URI if present in the intent
- when the output URI is specified,
- for Image Capture, we return a `Bitmap` as a `data` extra and also the URI as the Intent data
- for Video Capture we return the `Uri` as the Intent data
- if no output URI is specified in the capture intent or if there is an error while trying to access the URI, use the default location with MediaStore, so we do not return inconsistent URIs (eg, SAF tree URIs)
- add CameraXInitializer to abstract CameraXPreview initialisation logic