Fixed
Status Update
Comments
je...@google.com <je...@google.com> #2
Hi, thanks for reporting. Should be an easy fix!
I'm guessing it should work find until ~ 2^23 items = ~ 8M items. How did you come across this bug? Do you have a ViewPager2 with that many items?
I'm guessing it should work find until ~ 2^23 items = ~ 8M items. How did you come across this bug? Do you have a ViewPager2 with that many items?
je...@google.com <je...@google.com> #3
Hi, good to hear that.
We have an implementation of RecyclerView.Adapter that supports "infinite looping". So when the infinite looping is enabled, the adapter's getItemCount() reports Int.MAX_VALUE items. We also call setCurrentItem to somewhere in the middle of item count on the ViewPager2, so that's how we got that far.
We have an implementation of RecyclerView.Adapter that supports "infinite looping". So when the infinite looping is enabled, the adapter's getItemCount() reports Int.MAX_VALUE items. We also call setCurrentItem to somewhere in the middle of item count on the ViewPager2, so that's how we got that far.
je...@google.com <je...@google.com> #4
For future reference: first item for which it fails is probably when mCurrentItem = (1 << 25) + 2
je...@google.com <je...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 2e9f35536432bed0677171c8ae59b4f67850915a
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jul 12 14:26:10 2019
Use double instead of float for decimal positions
A position ranges from 0 to Integer.MAX_VALUE, but floats only have a 23
bit mantissa. Values over 2^23 are rounded to a nearby value.
Solve this by using double instead of float when we need to represent a
position with a fractional component. A double has a mantissa of 52 bit
and can therefore represent all 2^32 possible int values.
Bug: 134858960
Test: ./gradlew viewpager2:cC
Change-Id: I08b97df6fac600caa83366ccab8671541e2c1e7f
A viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/SparseAdapter.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/OffscreenPageLimitTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageChangeCallbackTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/SetItemWhileScrollInProgressTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1014538
https://goto.google.com/android-sha1/2e9f35536432bed0677171c8ae59b4f67850915a
Branch: androidx-master-dev
commit 2e9f35536432bed0677171c8ae59b4f67850915a
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jul 12 14:26:10 2019
Use double instead of float for decimal positions
A position ranges from 0 to Integer.MAX_VALUE, but floats only have a 23
bit mantissa. Values over 2^23 are rounded to a nearby value.
Solve this by using double instead of float when we need to represent a
position with a fractional component. A double has a mantissa of 52 bit
and can therefore represent all 2^32 possible int values.
Bug: 134858960
Test: ./gradlew viewpager2:cC
Change-Id: I08b97df6fac600caa83366ccab8671541e2c1e7f
A viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/SparseAdapter.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/OffscreenPageLimitTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageChangeCallbackTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/SetItemWhileScrollInProgressTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
jg...@google.com <jg...@google.com>
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f4ef0c4ea7c143931a166169ffdf499323f60842
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Sep 20 16:44:31 2019
Fix broken AccessibilityTest
performAccessibilityAction should be called on the UI thread. For some
reason it never surfaced before, presumably because the scrolling that
it triggers was performed in onAnimation and not as a direct result of
the action. Now we clear focus, however, this action triggers a change
in the view and the test crashes.
Bug: 140656866
Test: ./gradlew recyclerview:recyclerview:cC \
-Pandroid.testInstrumentationRunnerArguments.class=\
androidx.viewpager2.widget.AccessibilityTest
Change-Id: Ia7113fac1f9152ddaea4499a56220fea09822407
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/AccessibilityTest.kt
https://android-review.googlesource.com/1126614
https://goto.google.com/android-sha1/f4ef0c4ea7c143931a166169ffdf499323f60842
Branch: androidx-master-dev
commit f4ef0c4ea7c143931a166169ffdf499323f60842
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Sep 20 16:44:31 2019
Fix broken AccessibilityTest
performAccessibilityAction should be called on the UI thread. For some
reason it never surfaced before, presumably because the scrolling that
it triggers was performed in onAnimation and not as a direct result of
the action. Now we clear focus, however, this action triggers a change
in the view and the test crashes.
Bug: 140656866
Test: ./gradlew recyclerview:recyclerview:cC \
-Pandroid.testInstrumentationRunnerArguments.class=\
androidx.viewpager2.widget.AccessibilityTest
Change-Id: Ia7113fac1f9152ddaea4499a56220fea09822407
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/AccessibilityTest.kt
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d9000ec31ab4743ed07c8aa713d506ea57c37de2
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Sep 20 15:49:02 2019
Clear focus on page change in ViewPager2
Makes sure that a page can't keep focus when it is moving out of the
screen.
Bug: 140656866
Test: follow-up
Change-Id: I4e0fece0d4c438da76bfcb10939ba1bc880e27e7
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1126610
https://goto.google.com/android-sha1/d9000ec31ab4743ed07c8aa713d506ea57c37de2
Branch: androidx-master-dev
commit d9000ec31ab4743ed07c8aa713d506ea57c37de2
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Sep 20 15:49:02 2019
Clear focus on page change in ViewPager2
Makes sure that a page can't keep focus when it is moving out of the
screen.
Bug: 140656866
Test: follow-up
Change-Id: I4e0fece0d4c438da76bfcb10939ba1bc880e27e7
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
jg...@google.com <jg...@google.com> #9
Fixes are in place now. Will come out in the next release.
ti...@gmail.com <ti...@gmail.com> #10
Any plan when the next release is?
jg...@google.com <jg...@google.com> #11
We are aiming to release beta05 with the fix on October 9, but we are unable to make promises as it depends on other AndroidX libraries.
ti...@gmail.com <ti...@gmail.com> #12
Thanks, that's somewhat useful.
an...@wpost.com <an...@wpost.com> #13
It looks like this change has broken the ability to use DPAD_LEFT or DPAD_RIGHT navigation by setting items as focusable.
https://android-review.googlesource.com/c/platform/frameworks/support/+/1125359/
Is there a workaround? I can make a sample if needed, and perhaps a new issue. Thanks!
Is there a workaround? I can make a sample if needed, and perhaps a new issue. Thanks!
jg...@google.com <jg...@google.com> #14
Fix for the original issue is now out (released on Oct 9 with beta05). Marking as Fixed.
Regarding comment#13 (DPAD_*) -- moving to http://issuetracker.google.com/142548536
Regarding
pa...@google.com <pa...@google.com> #15
This is still happening for me (see
In our code, we have
viewpager.setFocusability(false)
but a child view is focusable. This combination causes the offending code to be called and the next item to show up briefly:
if (hasFocus()) { // if clear focus did not succeed
mRecyclerView.requestFocus(View.FOCUS_FORWARD);
}
Reading the commit history it looks like the above code was added for API < 28. Is it possible to check for both hasFocus() && API < 28
here?
ap...@google.com <ap...@google.com> #16
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 4e83b07b60706d954045f24b600338fae14abb2c
Author: Jakub Gielzak <jgielzak@google.com>
Date: Mon Sep 23 19:53:57 2019
Clear focus on page change on API < 28
Follow-up to: I4e0fece0d4c438da76bfcb10939ba1bc880e27e7
Bug: 140656866
Test: follow-up
Change-Id: I91bcd072e1812eeb20fbce6fb989557d60079bb7
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1126151
Branch: androidx-master-dev
commit 4e83b07b60706d954045f24b600338fae14abb2c
Author: Jakub Gielzak <jgielzak@google.com>
Date: Mon Sep 23 19:53:57 2019
Clear focus on page change on API < 28
Follow-up to: I4e0fece0d4c438da76bfcb10939ba1bc880e27e7
Bug: 140656866
Test: follow-up
Change-Id: I91bcd072e1812eeb20fbce6fb989557d60079bb7
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
Description
I've added the keyboard hiding to my previously used (another bug report) example
To replicate the issue, switch to second page(FORM), focus the editText, leave the keyboard open and use the tab to switch to the third page(LAST). The ViewPager jumps to LAST page for a split second and then immediately back to FORM. If the keyboard is not showing, then the page changes happens without any problem.
Using View/Handler.post for hideKeyboard invocation doesn't change the outcome, only postDelayed with long enough delay "works".