-
Notifications
You must be signed in to change notification settings - Fork 26
Android: add onTextLayout
listener on the TextView component
#912
Android: add onTextLayout
listener on the TextView component
#912
Conversation
This should allow us to use this result for text-based layouts.
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { | ||
super.onMeasure(widthMeasureSpec, heightMeasureSpec) | ||
|
||
layout?.let { onTextLayoutChanged?.invoke(it) } |
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.
Here the text has already been measured so we can return this.layout
through the callback.
import timber.log.Timber | ||
import uniffi.wysiwyg_composer.Disposable | ||
|
||
internal class RustCleanerTask( | ||
private val disposable: Disposable, | ||
) : Runnable { | ||
override fun run() { | ||
Timber.d("Cleaning up disposable: $disposable") | ||
if (BuildConfig.DEBUG) { |
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 added this because the debug logs added here were being printed by the EXA app in debug mode. I could also remove the log completely.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
============================================
+ Coverage 87.48% 89.43% +1.94%
============================================
Files 166 86 -80
Lines 18999 15358 -3641
Branches 1030 0 -1030
============================================
- Hits 16622 13735 -2887
+ Misses 2075 1623 -452
+ Partials 302 0 -302
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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, thanks!
@@ -34,6 +35,7 @@ fun EditorStyledText( | |||
resolveMentionDisplay: (text: String, url: String) -> TextDisplay = RichTextEditorDefaults.MentionDisplay, | |||
resolveRoomMentionDisplay: () -> TextDisplay = RichTextEditorDefaults.RoomMentionDisplay, | |||
onLinkClickedListener: ((String) -> Unit) = {}, | |||
onTextLayout: (Layout) -> Unit = {}, |
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.
Is there a reason why the parameter is not called onTextLayoutChanged
?
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.
Not really, I think I just missed the mismatch here.
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
This should allow us to use this result for text-based layouts.