QuickEditor: Take photo action in the media picker#266
QuickEditor: Take photo action in the media picker#266AdamGrzybkowski merged 7 commits intotrunkfrom
Conversation
dd46586 to
e2cefd6
Compare
gradle/libs.versions.toml
Outdated
| appcompat = "1.7.0" | ||
| material = "1.12.0" | ||
| ucrop = "2.2.9" | ||
| ucrop = "2.2.9-native" |
There was a problem hiding this comment.
I had to switch to the native version because the compression wouldn't work for me and the uploaded avatar would be the same size as the original image despite the compression.
There was a problem hiding this comment.
From uCrop's documentation:
implementation 'com.github.yalantis:ucrop:2.2.8-native' - get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
1.5 MB is a lot. Is there any workaround?
There was a problem hiding this comment.
I haven't found one in this library. We can handle the compression ourselves on top of it though, but that will be tricky as we have to be careful not to duplicate the compression when the one from the library works (I imagine this might be dependent on the system version for example).
Using the -native variant seemed like a better pick for now to not spend too much time on it.
There was a problem hiding this comment.
@maxme I'm curious to know what you think of this
There was a problem hiding this comment.
Adding 1.5Mb is not ideal, but what worries me most is adding native code to our library dependencies. For deployments on the app store, it's going to be extra steps, and might be limiting for our users. They might be surprised they have native code and might look for the culprit dependency.
There was a problem hiding this comment.
I had to switch to the native version because the compression wouldn't work for me and the uploaded avatar would be the same size as the original image despite the compression.
Do you get some logs or is this a silent error (they skip the compression steps maybe)?
There was a problem hiding this comment.
I haven't seen any errors (I haven't looked for them though at that point) just that the final image had the exact same size as the photo taken with the camera. I will take another look at it.
There was a problem hiding this comment.
I'm testing this on different devices/emulators and the image size is always the same. The compression seems to work in a way that you can clearly see the drop in the image quality and the width/height sizes. Yet the file size remains unchanged.
There was a problem hiding this comment.
I removed the -native version for now.
|
|
||
| private const val UCROP_COMPRESSION_QUALITY = 100 | ||
| private const val UCROP_COMPRESSION_QUALITY = 90 | ||
| private const val UCROP_MAX_IMAGE_SIZE = 1080 |
There was a problem hiding this comment.
Set this as the max size for now - seems enough for an Avatar though happy to hear your opinions.
d486a81 to
b60791e
Compare
e2cefd6 to
c256b3a
Compare
b60791e to
7423491
Compare
4189b9c to
1be8d2f
Compare
|
Note: we're currently waiting for a reply/merge to fix a bug in uCrop - Yalantis/uCrop#926 |
I don't think it makes sense to block this PR because of this. We can fix this later by either updating the UCrop version or switching to our fork. |
1be8d2f to
dbd6953
Compare
Closes #225
Description
This PR implements the
Take photooption from the media picker popup.An important bit here is the
FileProviderconfig - this needs to be custom so that it will work when the app implementing our library has its ownFileProvidersetup. You can read about it here.I've also added a config to our DemoApp to make sure this works (that's how I discovered this needs to be handled).
take_photo.mp4
Testing Steps
Important Note: The backend is currently returning the wrong format for the
updated datefield. As a workaround, you can apply this patch to comment that field from the Avatar object.Gravatar-Android-13-04-48.patch
Update AvatarbuttonUpload ImagebuttonTake photo