SimpleMobileTools / Simple-Camera

Quick photo and video camera with a flash, customizable aspect ratio.
https://www.simplemobiletools.com
GNU General Public License v3.0
750 stars 288 forks source link

Preview alignment improvements #380

Closed KryptKode closed 1 year ago

KryptKode commented 1 year ago

Notes

The GestureDetector.SimpleOnGestureListener class is in Java and the MotionEvent parameters to onFling are marked as @NonNull. When used in a Kotlin file, the compiler will add Instrisincs.checkNotNullParameter checks before our code and this is what causes the crash

Screenshot 2022-11-14 at 19 34 59 Screenshot 2022-11-25 at 07 58 41

To fix it, we have to create GestureDetectorListener, a Java wrapper file for the SimpleOnGestureListener class and mark the parameters as @Nullable. So now, the Kotlin compiler will not add these non-null checks.

Screenshot 2022-11-26 at 13 06 03
tibbi commented 1 year ago

placement works well, hope the crashfix will work too. Thanks