Simple-Camera icon indicating copy to clipboard operation
Simple-Camera copied to clipboard

Camera UI fixes

Open KryptKode opened this issue 3 years ago • 6 comments

Notes

  • fix the back button bug that prevented exiting the app
  • remove change bounds animation
  • handle storage permissions
    • handle requesting READ_MEDIA_IMAGES and READ_MEDIA_VIDEO for Android 13+
    • request WRITE_EXTERNAL_STORAGE for Android 12 and below
    • set the permission WRITE_EXTERNAL_STORAGE to maxSdkVersion=32 in the AndroidManifest
  • update CameraX to 1.2.0-beta02
  • update top layout and 1x1 and full screen icons

KryptKode avatar Sep 29 '22 00:09 KryptKode

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.

tibbi avatar Sep 29 '22 07:09 tibbi

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)

tibbi avatar Sep 29 '22 07:09 tibbi

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.

tibbi avatar Sep 29 '22 07:09 tibbi

Hi @tibbi,

  1. 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 FrameLayout and 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.

  1. 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.

KryptKode avatar Sep 29 '22 15:09 KryptKode

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.

tibbi avatar Sep 30 '22 08:09 tibbi

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)

tibbi avatar Oct 05 '22 19:10 tibbi

alright, looks good now, will do more testing on different devices and see how it goes :) Thanks

tibbi avatar Oct 06 '22 16:10 tibbi