[Bug] Fixed long list jumping in Android 13 samsung devices. #1690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theSimplenoteEditText
, which I initially investigated.I was able to drill down on a specific method in
NestedScrollView
,computeScrollDeltaToGetChildRectOnScreen
. The key isscrollYDelta
. I observed that the parameter,Rect
has a weird offset between what thescrollY
position is and what theRect.top
position is after theEditText
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 overriderequestChildRectangleOnScreen
, 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 theRect.top
to thescrollY
, which is the scroll position of theNestedScrollView
. 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
Review
N/A
Release
N/A