-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rich text editor] Add ability to insert GIFs from keyboard #8185
Conversation
Closes vector-im/verticals-internal#21
80e0bdb
to
f1f4eed
Compare
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one question.
@@ -188,6 +190,16 @@ internal class RichTextComposerLayout @JvmOverloads constructor( | |||
views.plainTextComposerEditText.addTextChangedListener( | |||
TextChangeListener({ callback?.onTextChanged(it) }, { updateTextFieldBorder(isFullScreen) }) | |||
) | |||
ViewCompat.setOnReceiveContentListener( | |||
views.richTextComposerEditText, | |||
arrayOf("image/*"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using what was used previously in ComposerEditText?
ViewCompat.getOnReceiveContentMimeTypes(views.richTextComposerEditText) ?: arrayOf("image/*")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit confused by this line actually. According to the docs getOnReceiveContentMimeTypes()
returns null by default, and otherwise returns any mime types set previously using setOnReceiveContentListener()
.
So I thought it would be redundant in the rich text editor but didn't want to risk breaking anything by removing it from the old composer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for your investigation.
@@ -188,6 +190,16 @@ internal class RichTextComposerLayout @JvmOverloads constructor( | |||
views.plainTextComposerEditText.addTextChangedListener( | |||
TextChangeListener({ callback?.onTextChanged(it) }, { updateTextFieldBorder(isFullScreen) }) | |||
) | |||
ViewCompat.setOnReceiveContentListener( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we should unregister all of these listeners but I suppose they will be destroyed with the view as they're owned by the view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was also my understanding that the OnReceiveContentListener
was attached to the view.
I had a look at the docs but couldn't see any requirement to unregister the listener. And neither are we unregistering the same type of listener on the existing composer so I think it's safe.
Type of change
Content
Add ability to insert GIFs from keyboard when rich text editor is enabled.
Motivation and context
Closes vector-im/verticals-internal#21
Screenshots / GIFs
gifs.webm
Tests
Tested devices
Checklist