Fixed
Status Update
Comments
er...@gmail.com <er...@gmail.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 47ac9fee0e3d43b4da33f53b8a2ff590f0d46079
Author: Jakub Gielzak <jgielzak@google.com>
Date: Tue Aug 20 13:57:06 2019
Addressed issues with EditText causing scroll
EditText methods: bringPointIntoView, and handleFocusGainInternal
trigger requestChildRectangleOnScreen in ViewPager2's internal
RecyclerView.
This can cause:
- unwanted scrolling -- e.g. when typing on some API versions
- a jump to page 0 -- EditText sometimes reports over -1M px mScrollX
This fix bypasses requestChildRectangleOnScreen calculations taking
advantage of the fact that PagerSnapHelper constraints valid scroll
values to a snapped position ones, and as a result, the problem is
reduced to choosing the correct currentItem.
Bug: 138044582
Bug: 139432498
Test: ./gradlew viewpager2:connectedCheck
Change-Id: Ia4d3e4e6734183e64f261c7cc76d669deae78da5
A viewpager2/src/androidTest/java/androidx/viewpager2/widget/EditTextFocusTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1107013
https://goto.google.com/android-sha1/47ac9fee0e3d43b4da33f53b8a2ff590f0d46079
Branch: androidx-master-dev
commit 47ac9fee0e3d43b4da33f53b8a2ff590f0d46079
Author: Jakub Gielzak <jgielzak@google.com>
Date: Tue Aug 20 13:57:06 2019
Addressed issues with EditText causing scroll
EditText methods: bringPointIntoView, and handleFocusGainInternal
trigger requestChildRectangleOnScreen in ViewPager2's internal
RecyclerView.
This can cause:
- unwanted scrolling -- e.g. when typing on some API versions
- a jump to page 0 -- EditText sometimes reports over -1M px mScrollX
This fix bypasses requestChildRectangleOnScreen calculations taking
advantage of the fact that PagerSnapHelper constraints valid scroll
values to a snapped position ones, and as a result, the problem is
reduced to choosing the correct currentItem.
Bug: 138044582
Bug: 139432498
Test: ./gradlew viewpager2:connectedCheck
Change-Id: Ia4d3e4e6734183e64f261c7cc76d669deae78da5
A viewpager2/src/androidTest/java/androidx/viewpager2/widget/EditTextFocusTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
er...@gmail.com <er...@gmail.com> #3
jg...@google.com <jg...@google.com> #4
beta04 with a fix for this was released today
jg...@google.com <jg...@google.com> #5
Btw, as a temporary workaround before a fix is released you can probably copy-paste the FragmentStateAdapter [1] class and patch it locally?
[1]https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java
[1]
ch...@beyls.net <ch...@beyls.net> #6
In my case the simplest workaround was to add fragment.setMenuItemVisible(false) directly in the createFragment(position) method of my adapters, right before returning the fragment.
jg...@google.com <jg...@google.com>
je...@google.com <je...@google.com>
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit dca177316c5d2771759641d01f956b0f49892ca7
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jan 17 17:32:28 2020
Fix for Fragment menu visibility issue in FSA
The fragment's menu visibility is directly related to the fragment's max
lifecycle. When the max lifecycle is STARTED, the menu should not be
visible. When the max lifecycle is RESUMED, the menu should be visible.
This CL fixes the bug where a fragment that is added to the fragment
manager by FragmentStateAdapter did set the max lifecycle to STARTED,
but did not set the menu visibility to false.
Relnote: "Fixed `FragmentStateAdapter` issue with initial fragment menu
visibility when adding a fragment to the `FragmentManager`."
Bug: 144442240
Test: ./gradlew viewpager2:viewpager2:cC \
-Pandroid.testInstrumentationRunnerArguments.class=\
androidx.viewpager2.widget.FragmentLifecycleTest
Change-Id: I9d2ffa0efcb03b63eeca25f2d4e74c81446a5774
M viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FragmentLifecycleTest.kt
M viewpager2/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java
https://android-review.googlesource.com/1211984
Branch: androidx-master-dev
commit dca177316c5d2771759641d01f956b0f49892ca7
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jan 17 17:32:28 2020
Fix for Fragment menu visibility issue in FSA
The fragment's menu visibility is directly related to the fragment's max
lifecycle. When the max lifecycle is STARTED, the menu should not be
visible. When the max lifecycle is RESUMED, the menu should be visible.
This CL fixes the bug where a fragment that is added to the fragment
manager by FragmentStateAdapter did set the max lifecycle to STARTED,
but did not set the menu visibility to false.
Relnote: "Fixed `FragmentStateAdapter` issue with initial fragment menu
visibility when adding a fragment to the `FragmentManager`."
Bug: 144442240
Test: ./gradlew viewpager2:viewpager2:cC \
-Pandroid.testInstrumentationRunnerArguments.class=\
androidx.viewpager2.widget.FragmentLifecycleTest
Change-Id: I9d2ffa0efcb03b63eeca25f2d4e74c81446a5774
M viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FragmentLifecycleTest.kt
M viewpager2/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java
je...@google.com <je...@google.com>
v....@gmail.com <v....@gmail.com> #8
I think this issue relates to https://issuetracker.google.com/issues/147550812 as well and that other issue can be marked as fixed too.
Checked on 1.1.0-alpha01 and can confirm the fix.
Checked on 1.1.0-alpha01 and can confirm the fix.
ni...@gmail.com <ni...@gmail.com> #9
Comment has been deleted.
14...@gmail.com <14...@gmail.com> #10
Still having issue in alpha, when you slide very fast, icon will disappear for a while!
je...@google.com <je...@google.com> #11
Can you file a new bug for that? It sounds like that is a separate issue where for a brief period of time there none of the fragments is in RESUMED state. We'd need to figure out if that is a bug or working as intended.
Description
As a result, between the time the fragment is added and the time it becomes the new primary fragment of the ViewPager2, its menu is briefly shown at the same time as the menu of the current primary fragment, creating a visual glitch of duplicate menu items.
Fix: update the code of FragmentStateAdapter to call newFragment.setMenuItemVisible(false) right after creating the fragment using createFragment(position)