element-android
element-android copied to clipboard
Add in-app camera
Type of change
- [x] Feature
- [ ] Bugfix
- [ ] Technical
- [ ] Other :
Content
This PR add a built-in / in-app camera to element as a lab feature. If the feature is not enable, it adds a button to attachment list to open the native camera for video.
Motivation and context
Currently, users have to choose between :
- choosing a default behavior for the camera (photo or video)
- or setting a default to one type.
That means, it adds clicks to take a photo/video or users won't change media type (it requires to go to settings to change the default behavior).
This fixes #1389, #2224, #3331, #1623 and maybe others.
Screenshots / GIFs
Outdated screenshots
- The camera view before recording a video
- The camera view while recording a video
- The camera view before taking a photo
- Only one attachment button to open a camera when the feature is enabled
- 2 attachment buttons to open a camera when the feature is disabled : one for a picture, one for a video
Tested devices
- [x] Physical
- [ ] Emulator
- OS version(s): Android 11
Checklist
- [ ] Changes has been tested on an Android device or Android emulator with API 21
- [x] UI change has been tested on both light and dark themes
- [x] Accessibility has been taken into account. See https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#accessibility
- [x] Pull request is based on the develop branch
- [x] Pull request includes a new file under ./changelog.d. See https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog
- [x] Pull request includes screenshots or videos if containing UI changes
- [x] Pull request includes a sign off
- [x] You've made a self review of your PR
- [x] If you have modified the screen flow, or added new screens to the application, you have updated the test UiAllScreensSanityTest.allScreensTest()
Thanks for the PR. @onurays can you review it please? I think you already worked on this part previously.
works fine in my Fork! But two things here, when I send pictures in Landscape the orientation is wrong and in Video mode the light is missing :( @p1gp1g
The fragment removal (https://github.com/vector-im/element-android/commit/2b5920e451f423067413973db1b130a6ebeb4449) brick the AttachmentsCameraFragment @p1gp1g
The fragment removal (2b5920e) brick the AttachmentsCameraFragment @p1gp1g
Thanks, it should be easy to fix. I'll check that when I can
Rebased (& fix the fragment)
@DoM1niC : Here is the orientation support :)
I think it looks OK now, so it is ready for review :)
Thanks for the PR! I have some UX-related remarks:
- I am a little bit surprised when the app suddenly requests audio recording permission. My intention was just to take a photo.
- In landscape mode, the orientation of icons is wrong (90 degrees rotated).
- When I want to record a video camera and video icons are switching their positions. This seems not like a common UX for me.
- While recording a video I expected to see a timer.
We need a design review before the code review. @gaelledel can you or someone else in the team have a look (I can send you an apk if needed).
Thanks for the review !
1. I am a little bit surprised when the app suddenly requests audio recording permission. My intention was just to take a photo.
That's needed for the video record, I guess you already gave the authorization for the camera so you have received the single last request. We can change the behavior to ask for this permission only once the user try to record a video.
2. In landscape mode, the orientation of icons is wrong (90 degrees rotated).
Can you give a screenshot of it ? It will help to see what's wrong. There was an issue with the orientationListener being enabled onCreate instead of onStart, it was probably because of that.
3. When I want to record a video camera and video icons are switching their positions. This seems not like a common UX for me.
The UX is inspired from Open Camera. We can change for another one (edit: cf note behind)
4. While recording a video I expected to see a timer.
Good idea, and done :)
Edit: Thanks to a long delay for my train, I've implement another UX : photo on click and video on longclick + flash for video, I m posting screenshots later
Here are the screenshots with the new UX
Outdated screenshots
Edit: Outdated screenshots, see first post for the last screenshots.
Would it be possible to add a button to switch the front/back camera?
Like here, from Telegram. WhatsApp has a similar icon.

Would it be possible to add a button to switch the front/back camera? Like here, from Telegram. WhatsApp has a similar icon.
That's the purpose of this button:

We may change to another icon if it is not obvious
Oh, thanks for the explanation. I thought it was for video recording but I just looked closer and saw the arrow 😄. I suggest to add "Tap for photo, hold for video" in order to make users understand that there is a "hidden" video record feature.
I have updated the screenshots on the first post
The Portrait and Landscaping is wrong here after Capture

The Portrait and Landscaping is wrong here after Capture <screenshot>
Does it happen often/Do you have instruction to reproduce ? I don't have this version installed anymore right now
The Portrait and Landscaping is wrong here after Capture
Does it happen often/Do you have instruction to reproduce ? I don't have this version installed anymore right now
I use your last Commits in my fork.... I just do a photo in portrait or landscape and the orientation still wrong for me...
THX for the fix https://github.com/vector-im/element-android/pull/6763/commits/ae2a9204075940da37e39db3f72ab4a9cd08cb16
we need some resolve :(
@p1gp1g can you resolve all issues from your current code ? THX 4 your Work!!!!