Commit Graph

57 Commits

Author SHA1 Message Date
e957ce607a save medias with location data if it's allowed 2023-07-24 21:06:29 +03:00
c1c9c49f04 adding some crashfixes 2023-01-15 21:26:54 +01:00
5c07521521 use raw coordinates for focus circle 2022-12-01 14:29:39 +00:00
c680a1b68a handle countdown timer sounds 2022-11-27 14:31:51 +00:00
034497ba52 Merge pull request #380 from KryptKode/feat/preview-aligment-improvements
Preview alignment improvements
2022-11-26 18:59:52 +01:00
47bc591035 improve preview alignment
- 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
2022-11-26 12:58:20 +00:00
ef2f3eb766 PR changes:
- remove rotating close icon from shutter button
- remove toggling flashlight on each countdown tick
- remove sound (to be addressed later)
2022-11-25 15:50:05 +00:00
772ffb21ad add camera timer 2022-11-25 07:11:41 +00:00
aee23700d8 update CameraX to 1.2.0-rc01
- fix issue where camera cannot be configured on some devices
- set the PreviewView  useCase surface provider before binding to camera
2022-11-24 15:18:54 +00:00
f08180aa38 fix video capture sound playing in video recording
- add custom MediaActionSound, with functionality to notify callers when playing sound ends
- only start video recording when the sound has played completely
2022-11-24 14:02:48 +00:00
fc2296e2ae fix inconsistencies when user switches camera mode fast
- 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
2022-11-23 14:32:16 +00:00
c858e5b908 fix inconsistencies when user switches camera mode fast
- debounce switching by 300ms when toggling between video/photo capture
- setCameraAvailable only when there is no error and the camera state is Type.OPEN
2022-11-11 00:44:53 +00:00
7b7838331e persist/restore torch state for video and image capture 2022-11-09 10:09:47 +00:00
2420b7dc31 Merge branch 'master' into feat/always-on-torch 2022-10-28 15:31:50 +02:00
dace1e9da8 small renaming 2022-10-24 16:32:34 +02:00
237421646d Merge pull request #357 from KryptKode/feat/capture-mode-toggle
add settings option for capture mode
2022-10-24 16:31:26 +02:00
d304088963 removing a redundant variable 2022-10-24 16:30:04 +02:00
3d4c38de04 add always on torch mode for image capture 2022-10-23 00:00:22 +01:00
a20c7137bb disable flinging on preview view
- only change camera mode when fling happens on the bottom tab
- so zoom gestures do not interfere with the fling
2022-10-22 23:36:41 +01:00
e412cec759 add settings option for capture mode 2022-10-22 23:21:58 +01:00
c40ac93b06 prioritize low latency over max quality by default 2022-10-11 09:41:56 +02:00
579f5d0514 disable PreviewView while capturing photo 2022-10-11 01:06:54 +01:00
ac3044f52b show shutter animation along with sound 2022-10-11 01:06:54 +01:00
cc3c2108cf properly play media sound on image capture
- 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
2022-10-08 03:07:42 +01:00
a2828b69c4 removing some no longer needed stuff 2022-10-06 19:31:50 +02:00
8f80fcc83f removing some empty lines here and there 2022-10-06 18:54:35 +02:00
315f8f559c close image after capturing as Bitmap 2022-10-05 13:09:21 +01:00
2627638a76 minor fixes for media output and toggling resolution
- handle exception when creating media output
- if only one resolution is supported, no need to restart the camera
2022-09-29 18:05:40 +01:00
75a8a0de76 updating kotlin, common, gradle and target SDK to 33 2022-09-21 12:36:35 +02:00
f02d0b3ae7 prevent reload when re-selecting resolution 2022-09-20 02:19:53 +01:00
0fdb751909 cleanup selection of media size
- add MediaSizeStore to manage write/read operations for the media size
2022-08-25 08:42:13 +01:00
fd5f64ecf3 add toggling flash mode / media size 2022-08-25 08:30:56 +01:00
e6a588a218 simpler UI for flash mode / media size 2022-08-22 14:27:07 +01:00
2ebeb5a1e4 use tabs for camera modes 2022-08-19 15:24:47 +01:00
d9193f7494 fix preview and capture resolutions
- 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
2022-08-17 01:12:18 +01:00
231a5f9c3f adjust preview based on selected aspect ratio
- 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
2022-07-15 21:32:54 +01:00
776e842af5 remove logs 2022-07-13 17:08:20 +01:00
9c021c655b do some optimisations for pre SDK 29 devices 2022-07-13 16:39:18 +01:00
44223d4ba9 refactor VideoQualityManager 2022-07-13 02:54:44 +01:00
6c1ccd8db7 fix getting video quality 2022-07-13 02:13:02 +01:00
210f3e35c0 use the resolution index instead of the qualities
- store and use the resolution index in Config class for video capture
2022-07-13 01:38:54 +01:00
d8ea6d5175 pass rotated resolution to ImageCaptureUsecase
- filter supported resolutions so 0MP resolutions are not selected. CameraX cannot apply these resolutions
2022-07-13 00:54:14 +01:00
d3d67ec4a4 remove exif info after image capture if user config.savePhotoMetadata == false 2022-07-12 22:15:44 +01:00
d5e1d61d02 fix passing bitmap thumbnail after IMAGE_CAPTURE intent
- 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
2022-07-09 02:55:41 +01:00
74e2656831 try to handle changing video quality and image resolution
- 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.
2022-07-08 00:12:03 +01:00
889a384f21 handle 3rd party image/video capture intents
- 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
2022-06-30 00:23:41 +01:00
f43cd4f939 handle some camera errors
- add CameraErrorHandler to handle
  - errors during camera lifecycle
  - when capturing images
  - when recording videos
2022-06-26 21:54:32 +01:00
b10d8639fd handle torch state in video capture
- set initial torch state to off
- enable/disable the torch when flash mode is on/off in video mode
2022-06-26 11:12:43 +01:00
79f9267383 handle storage location
- add MediaOutputHelper
   - to create OutputStream for photos
   - to create FileDescriptor for videos (currently requires API 26+)
2022-06-26 10:58:17 +01:00
d168040722 replace property getters with actual functions in CameraXPreview 2022-06-25 23:25:20 +01:00