Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Android: add onTextLayout listener on the TextView component #912

Merged
merged 2 commits into from
Dec 26, 2023

Conversation

jmartinesp
Copy link
Contributor

This should allow us to use this result for text-based layouts.

This should allow us to use this result for text-based layouts.
@jmartinesp jmartinesp requested a review from bmarty December 26, 2023 12:50
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)

layout?.let { onTextLayoutChanged?.invoke(it) }
Copy link
Contributor Author

@jmartinesp jmartinesp Dec 26, 2023

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) {
Copy link
Contributor Author

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-commenter
Copy link

codecov-commenter commented Dec 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fcfef8a) 87.48% compared to head (235aa63) 89.43%.

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     
Flag Coverage Δ
uitests ?
uitests-android ?
uitests-ios ?
unittests 89.43% <ø> (+3.86%) ⬆️
unittests-android ?
unittests-ios ?
unittests-rust 89.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@bmarty bmarty left a 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 = {},
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@jmartinesp jmartinesp merged commit e9e9048 into main Dec 26, 2023
6 of 7 checks passed
@jmartinesp jmartinesp deleted the feature/jme/android-add-on-text-layout-lambda branch December 26, 2023 16:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants