Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Add helper for underlining text #12520

Merged
merged 1 commit into from
Jul 16, 2020
Merged

Conversation

NotWoods
Copy link
Contributor

Adding an underline to a TextView seems to be a fairly common pattern, so lets put it in a helper method. Also adds more tests to some of the changed components.

@NotWoods NotWoods added eng:health Improve code health eng:test-debt Test debt. Unit test creation or maintenance. labels Jul 13, 2020
Copy link
Contributor

@jhugman jhugman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everytime I see PR like this, I pour one out for Netbeans Jackpot.

text = currentText.toSpannable().apply {
setSpan(UnderlineSpan(), 0, currentText.length, 0)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer an extension property here, or at least make the method take an optional start, end or start, len arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What sort of property are you thinking of? I'd prefer not to add the arguments as all the uses of UnderlineSpan just underline the entire string.

@NotWoods NotWoods closed this Jul 13, 2020
@NotWoods NotWoods reopened this Jul 13, 2020
@NotWoods NotWoods closed this Jul 14, 2020
@NotWoods NotWoods reopened this Jul 14, 2020
@codecov-commenter
Copy link

Codecov Report

Merging #12520 into master will increase coverage by 0.20%.
The diff coverage is 78.57%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #12520      +/-   ##
============================================
+ Coverage     24.73%   24.94%   +0.20%     
- Complexity      828      830       +2     
============================================
  Files           388      389       +1     
  Lines         15668    15625      -43     
  Branches       2024     2019       -5     
============================================
+ Hits           3875     3897      +22     
+ Misses        11480    11417      -63     
+ Partials        313      311       -2     
Impacted Files Coverage Δ Complexity Δ
...org/mozilla/fenix/home/tips/ButtonTipViewHolder.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...g/mozilla/fenix/settings/logins/SavedLoginsView.kt 17.14% <0.00%> (+1.35%) 0.00 <0.00> (ø)
...oncontrol/viewholders/onboarding/OnboardingIcon.kt 75.00% <66.66%> (+15.00%) 0.00 <0.00> (ø)
...pp/src/main/java/org/mozilla/fenix/ext/TextView.kt 100.00% <100.00%> (ø) 0.00 <0.00> (?)
...iewholders/PrivateBrowsingDescriptionViewHolder.kt 100.00% <100.00%> (+100.00%) 1.00 <0.00> (+1.00)
...ers/onboarding/OnboardingManualSignInViewHolder.kt 100.00% <100.00%> (+7.69%) 2.00 <0.00> (ø)
...holders/onboarding/OnboardingWhatsNewViewHolder.kt 100.00% <100.00%> (+100.00%) 1.00 <0.00> (+1.00)
...nix/trackingprotectionexceptions/ExceptionsView.kt 100.00% <100.00%> (ø) 4.00 <0.00> (ø)
...va/org/mozilla/fenix/components/metrics/Metrics.kt 21.62% <0.00%> (+0.27%) 0.00% <0.00%> (ø%)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0491b7...fcbe524. Read the comment docs.

@NotWoods NotWoods merged commit d4bb432 into mozilla-mobile:master Jul 16, 2020
@NotWoods NotWoods deleted the add-underline branch July 16, 2020 05:38
@liuche liuche mentioned this pull request Jul 20, 2020
9 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
eng:health Improve code health eng:test-debt Test debt. Unit test creation or maintenance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants