Skip to content
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

Merged
merged 22 commits into from
Jun 11, 2023
Merged

Remove ReplacementSpan, display diffs using CharacterStyle #3431

merged 22 commits into from
Jun 11, 2023

Conversation

nikclayton
Copy link
Contributor

@nikclayton nikclayton commented Mar 11, 2023

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.

Nik Clayton added 17 commits February 12, 2023 18:01
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
@Tak
Copy link
Collaborator

Tak commented Mar 13, 2023

History is not the same as a conversation thread.
IMO the order should be newest to oldest, just like a version control log.

@connyduck
Copy link
Collaborator

History is not the same as a conversation thread.
IMO the order should be newest to oldest, just like a version control log.

yes please change

…dits

# Conflicts:
#	app/src/main/res/values/strings.xml
@nikclayton nikclayton changed the title Update display of status diffs Remove ReplacementSpan, display diffs using CharacterStyle Jun 1, 2023
Nik Clayton added 2 commits June 1, 2023 19:11
- 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
@nikclayton
Copy link
Contributor Author

History is not the same as a conversation thread.
IMO the order should be newest to oldest, just like a version control log.

yes please change

Done.

@nikclayton nikclayton requested a review from connyduck June 1, 2023 17:15
@nikclayton nikclayton merged commit 66a3942 into tuskyapp:develop Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants