element-android icon indicating copy to clipboard operation
element-android copied to clipboard

Add in-app camera

Open p1gp1g opened this issue 3 years ago • 20 comments

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()

p1gp1g avatar Aug 07 '22 13:08 p1gp1g

Thanks for the PR. @onurays can you review it please? I think you already worked on this part previously.

bmarty avatar Aug 16 '22 15:08 bmarty

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

DoM1niC avatar Aug 24 '22 18:08 DoM1niC

The fragment removal (https://github.com/vector-im/element-android/commit/2b5920e451f423067413973db1b130a6ebeb4449) brick the AttachmentsCameraFragment @p1gp1g

DoM1niC avatar Aug 26 '22 15:08 DoM1niC

The fragment removal (2b5920e) brick the AttachmentsCameraFragment @p1gp1g

Thanks, it should be easy to fix. I'll check that when I can

p1gp1g avatar Aug 26 '22 15:08 p1gp1g

Rebased (& fix the fragment)

p1gp1g avatar Aug 27 '22 14:08 p1gp1g

@DoM1niC : Here is the orientation support :)

p1gp1g avatar Aug 27 '22 15:08 p1gp1g

I think it looks OK now, so it is ready for review :)

p1gp1g avatar Aug 29 '22 20:08 p1gp1g

Thanks for the PR! I have some UX-related remarks:

  1. I am a little bit surprised when the app suddenly requests audio recording permission. My intention was just to take a photo.
  2. In landscape mode, the orientation of icons is wrong (90 degrees rotated).
  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.
  4. 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).

onurays avatar Sep 05 '22 12:09 onurays

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

p1gp1g avatar Sep 05 '22 18:09 p1gp1g

Here are the screenshots with the new UX

Outdated screenshots

Edit: Outdated screenshots, see first post for the last screenshots.

p1gp1g avatar Sep 06 '22 07:09 p1gp1g

Would it be possible to add a button to switch the front/back camera? Like here, from Telegram. WhatsApp has a similar icon. photo_resized

kojid0 avatar Sep 06 '22 08:09 kojid0

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:

image

We may change to another icon if it is not obvious

p1gp1g avatar Sep 06 '22 09:09 p1gp1g

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.

kojid0 avatar Sep 06 '22 09:09 kojid0

I have updated the screenshots on the first post

p1gp1g avatar Sep 12 '22 21:09 p1gp1g

The Portrait and Landscaping is wrong here after Capture Screenshot_20220929-174453.png

DoM1niC avatar Sep 29 '22 15:09 DoM1niC

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

p1gp1g avatar Sep 29 '22 15:09 p1gp1g

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

DoM1niC avatar Oct 01 '22 09:10 DoM1niC

THX for the fix https://github.com/vector-im/element-android/pull/6763/commits/ae2a9204075940da37e39db3f72ab4a9cd08cb16

we need some resolve :(

DoM1niC avatar Oct 05 '22 19:10 DoM1niC

@p1gp1g can you resolve all issues from your current code ? THX 4 your Work!!!!

DoM1niC avatar Oct 08 '22 13:10 DoM1niC