-
Notifications
You must be signed in to change notification settings - Fork 23
[Android] Add support for subcomposition and sharing state #822
Conversation
ccd7d0c
to
910aacd
Compare
910aacd
to
3444608
Compare
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.
Just a few nits hoping they area useful. Sorry for not being more of help here.
Although I don't understand what's the reason for switching off registerStateUpdates
in a subcomposition. Without state updates the RTE is pretty much useless isn't it?
...roid/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorState.kt
Outdated
Show resolved
Hide resolved
...s/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt
Outdated
Show resolved
Hide resolved
...roid/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorState.kt
Outdated
Show resolved
Hide resolved
...s/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt
Outdated
Show resolved
Hide resolved
In a subcomposition the editor is composed twice, once for measurement and once again to be placed in the layout given the first measurement. During the first measurement I need the editor to just be a dumb view and read the state but not try to update it in any way that might impact the second step. Hope that makes sense? An alternative could be to create a new instance of the state for every subcomposition but we'd also have the issue of the first composition requesting focus each frame, which I'm not sure how to avoid. |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #822 +/- ##
============================================
+ Coverage 87.06% 89.88% +2.82%
============================================
Files 155 82 -73
Lines 17983 14725 -3258
Branches 901 0 -901
============================================
- Hits 15656 13236 -2420
+ Misses 2068 1489 -579
+ Partials 259 0 -259
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
36e44f7
to
a4b490a
Compare
Kudos, SonarCloud Quality Gate passed! |
I still did not understand this completely. Can you point me to a piece of code that shows this? (using the RTE in a subcomp). |
Sure, my draft work for full screen mode in Element X shows this in action: |
- Add full screen mode for the rich text editor (RTE). When text formatting options are enabled, the editor can be dragged to full screen. - Remove `ConstraintLayout` from `textcomposer` module, now made much simpler now the RTE supports being called in multiple layouts matrix-org/matrix-rich-text-editor#822 - Part of element-hq/element-meta#1973 - Includes design from #1315 - Fixes #1293 (through new layout) - Fixes #1394 (through inclusion of matrix-org/matrix-rich-text-editor#824) - Fixes #1259 (through inclusion of matrix-org/matrix-rich-text-editor#820) --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
Changes
factory
andupdate
blocks can be called again by the replacement editor instance safely.Context
To enable the editor to be embedded in complex layouts that require pre-measurement and/or multiple layout trees.