Camera UI fixes
Notes
- fix the back button bug that prevented exiting the app
- remove change bounds animation
- handle storage permissions
- handle requesting
READ_MEDIA_IMAGESandREAD_MEDIA_VIDEOfor Android 13+ - request
WRITE_EXTERNAL_STORAGEfor Android 12 and below - set the permission
WRITE_EXTERNAL_STORAGEto maxSdkVersion=32 in the AndroidManifest
- handle requesting
- update CameraX to
1.2.0-beta02 - update top layout and 1x1 and full screen icons
the shutter sound plays way too early, before the actual photo is taken. And the top menu after extending the aspect ratio or flashlight are still a bit lower than the main buttons on the main screen. Cant you just use the same margin there? I can see the 4:3 moving a bit after reselectingi t.
and capturing a video crashes right after start on my Android 11, java.lang.IllegalArgumentException: Failed to determine if primary:DCIM/Camera/VID_20220929_091104.mp4 is child of primary:DCIM: java.io.FileNotFoundException: Missing file for primary:DCIM/Camera/VID_20220929_091104.mp4 at /storage/emulated/0/DCIM/Camera/VID_20220929_091104.mp4 at com.android.internal.content.FileSystemProvider.isChildDocument(FileSystemProvider.java:143) at android.provider.DocumentsProvider.enforceTree(DocumentsProvider.java:228) at android.provider.DocumentsProvider.openAssetFile(DocumentsProvider.java:1343) at android.content.ContentProvider$Transport.openAssetFile(ContentProvider.java:543) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:286) at android.os.Binder.execTransactInternal(Binder.java:1165) at android.os.Binder.execTransact(Binder.java:1134) 2022-09-29 09:11:04.124 22913-22913/com.simplemobiletools.camera.debug E/AndroidRuntime: FATAL EXCEPTION: main Process: com.simplemobiletools.camera.debug, PID: 22913 java.lang.IllegalArgumentException: Failed to determine if primary:DCIM/Camera/VID_20220929_091104.mp4 is child of primary:DCIM: java.io.FileNotFoundException: Missing file for primary:DCIM/Camera/VID_20220929_091104.mp4 at /storage/emulated/0/DCIM/Camera/VID_20220929_091104.mp4 at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172) at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153) at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:727) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1835) at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1650) at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1597) at com.simplemobiletools.camera.helpers.MediaOutputHelper.getFileDescriptorMediaOutput(MediaOutputHelper.kt:140) at com.simplemobiletools.camera.helpers.MediaOutputHelper.getVideoMediaOutput(MediaOutputHelper.kt:79) at com.simplemobiletools.camera.implementations.CameraXPreview.startRecording(CameraXPreview.kt:517) at com.simplemobiletools.camera.implementations.CameraXPreview.toggleRecording(CameraXPreview.kt:506) at com.simplemobiletools.camera.activities.MainActivity.handleShutter(MainActivity.kt:423) at com.simplemobiletools.camera.activities.MainActivity.shutterPressed(MainActivity.kt:411) at com.simplemobiletools.camera.activities.MainActivity.initButtons$lambda-6(MainActivity.kt:362) at com.simplemobiletools.camera.activities.MainActivity.$r8$lambda$lY85W6e3V0bThE5d6acXvA3oJAM(Unknown Source:0) at com.simplemobiletools.camera.activities.MainActivity$$ExternalSyntheticLambda11.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7520) at android.view.View.performClickInternal(View.java:7489) at android.view.View.access$3600(View.java:826) at android.view.View$PerformClick.run(View.java:28555) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8068) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
it actually isnt crashing on a fresh install, try checking an upgrade from the old to new version, there are still many people using the old one. That bottom shadow seems to be higher during videos without a reason than at photos. Guess moving the recording time above the shutter button would help, theres still enough place.
Hi @tibbi,
- About the top margin
It is not very visible on my end. Both the main icons and the aspect ratio and flashlight selector icons have been added to a root
FrameLayoutand the top margin is applied to that.
The only difference I noticed is in the height. So I will set them to be the same height and hopefully, this would correct what you observed.
- Shutter sound Would you want the shutter sound to play at the point when the picture is saved? I am afraid that would be too late. OnePlus app plays it as soon as the capture button is clicked alongside the blinking animation of the screen.
shutter sound has to be played at exact same time as the photo is captured. I moved the phone after hearing the sound and the images were blurry.
it crashes if I use Video mode and click on HD and pick any resolution (4 items available), then click on Photo and click on the aspect ratio picker. Guess it will be because the 16:9 ratio is hidden and you count on 4 items being visible or so. Process: com.simplemobiletools.camera.debug, PID: 31898 java.lang.IndexOutOfBoundsException: getChildDrawingOrder() returned invalid index 3 (child count is 3) at android.view.ViewGroup.getAndVerifyPreorderedIndex(ViewGroup.java:2125) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7285) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7288) at com.android.internal.policy.DecorView.gatherTransparentRegion(DecorView.java:361) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3271) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2206) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8763) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352) at android.view.Choreographer.doCallbacks(Choreographer.java:1149) at android.view.Choreographer.doFrame(Choreographer.java:1049) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1333) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8068) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
alright, looks good now, will do more testing on different devices and see how it goes :) Thanks