-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
Remove ReplacementSpan, display diffs using CharacterStyle #3431
Remove ReplacementSpan, display diffs using CharacterStyle #3431
Conversation
Diff each status against the previous version, comparing the different HTML as XML to produce a structured diff. Mark new content with `<ins>`, deleted content with `<del>`. Convert these to styled spans in `ViewEditsAdapter`.
Fixes issue with diffs splitting on accented characters
Don't use HTML spans and try and format them, create real Android spans. Do this with a custom tag handler that can add custom spans that set the text paint appropriately.
Make the background slightlysofter by drawing it as a roundrect. Make the spans easier to understand by padding the start/end of each one with the width of a " " character. This is visual only, the underlying text is not changed.
# Conflicts: # app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsViewModel.kt
A ReplacementSpan can't cover multiple lines, so if the modified text was more than a line it ran off the end of the screen. https://medium.com/androiddevelopers/drawing-a-rounded-corner-background-on-text-5a610a95af5 suggests a fix which involves a custom textview.
- Show the most recent version in larger text, both to make the most recent version clearer, and for consistency with the thread view (where the version the user clicked in will also have been shown in larger text) - Scroll the most recent version in to view - Show a pinned header with the author's avatar, display name, and username in one place, instead of duplicating this information in each version of the status.
# Conflicts: # app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsAdapter.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsViewModel.kt
app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsViewModel.kt
Outdated
Show resolved
Hide resolved
…d/edits/ViewEditsViewModel.kt
History is not the same as a conversation thread. |
yes please change |
…dits # Conflicts: # app/src/main/res/values/strings.xml
- Resolve lint errors
…n/Tusky into 3306-diff-status-edits # Conflicts: # app/src/main/java/com/keylesspalace/tusky/components/viewthread/edits/ViewEditsViewModel.kt # app/src/main/res/values/strings.xml
Done. |
Remove the use of
ReplacementSpan
. It turns out this span type is incompatible with spans that occupy more than one line, and the result is that a longer diff can run off the end of the screen. The alternative means that the diff'd text doesn't have additional padding and rounded corners, but it's better than not being visible.Display the most recent version of the status with larger text. Again, consistent with the thread view.
Display the avatar, name, and username of the poster in a pinned header at the top of the screen, instead of duplicating the information on every edit. This reduces the amount of redundant information on the screen.