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

[Bug] Fixed long list jumping in Android 13 samsung devices. #1690

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

notandyvee
Copy link
Contributor

@notandyvee notandyvee commented Sep 10, 2024

Fix

This PR attempted to fix a long standing issues on Android 13 samsung devices: #1580 . While editing a note and moving around the cursor, it can be observed that the view takes you all the way to the bottom of the screen, just above the tags. The tags part is very important as we will briefly go into.

Based on my extensive testing I figured out why this bug was happening. If you pay close attention when the bug occurs, you'll notice that the visible screen stops right above the tags component. This is very specific as it is not technically the very bottom of the screen. This led me to investigate NestedScrollView and not the SimplenoteEditText, which I initially investigated.

I was able to drill down on a specific method in NestedScrollView, computeScrollDeltaToGetChildRectOnScreen. The key is scrollYDelta. I observed that the parameter, Rect has a weird offset between what the scrollY position is and what the Rect.top position is after the EditText gets focus. Unfortunately I could not figure out the exact cause of the problem. Debugging the app didn't show me a useful debug stack, which really hindered understanding the root cause.

With that said, I came up with a hack to make this work. I created a custom view, CustomNestedScrollView. You just override requestChildRectangleOnScreen, which is the starting point for these calculations. You then just check if the device manufacturer and the android version numbers matches, and force set the Rect.top to the scrollY, which is the scroll position of the NestedScrollView. Meaning it should be an accurate representation of the top y position of the screen.

Note: In order to avoid bigger issues, I opted to gate this fix to samsung devices running Android 13. Should we attempt to gate it further by checking the keyboard? Is it accurate?

Test

  • Test using a samsung device running Android 13 using the stock samsung keyboard.
  • Test creating a note and editing it.
  • Test using a really long note, as described in the issue. Trying and reproduce the issue.

Review

N/A

Release

N/A

@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 10, 2024

📲 You can test the changes from this Pull Request in Simplenote Android by scanning the QR code below to install the corresponding build.

App Name Simplenote Android
Build TypeDebug
Commit20130d1
Direct Downloadsimplenote-android-prototype-build-pr1690-20130d1-0191daae-91fc-4c5c-8952-73717414194c.apk

@mokagio
Copy link
Contributor

mokagio commented Sep 10, 2024

@notandyvee @danilo04 FYI, I merged trunk in here because of a change in the GitHub check requirement which would otherwise have prevented this PR to land in either trunk or release/2.34.

image

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.

6 participants