Fixed
Status Update
Comments
jg...@google.com <jg...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit fb1c82582399043b149eb2630f524c75de9c88dc
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Aug 15 11:34:36 2019
Disallow intercept, touch slop and canScroll in nestedPreScroll
* Disallow intercept (requestDisallowInterceptTouchEvent(true))
When scroll delta is consumed by dispatchNestedPreScroll, the parent
should be requested not to intercept subsequent touch events, just as
when scroll is consumed by the widget itself or dispatchNestedScroll.
* Touch slop
NestedScrollingChild implementations should only call
dispatchNestedPreScroll after the delta x/y has exceeded the touch slop.
* canScroll (canScrollHorizontally/canScrollVertically)
The dx/dy values passed to dispatchNestedPreScroll should be zero if the
child can't scroll in that direction.
Fixed in:
- RecyclerView
- NestedScrollView
Bug: 138668210
Bug: 139530818
Test: ./gradlew connectedCheck
Change-Id: I85b327ad096fbbd204adb92f630770ec7fad5990
M core/core/src/androidTest/java/androidx/core/widget/NestedScrollViewNestedScrollingChildTest.java
M core/core/src/main/java/androidx/core/widget/NestedScrollView.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrolling3RequestDisallowInterceptTouchTest.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrollingChildTest.java
M recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
https://android-review.googlesource.com/1105373
https://goto.google.com/android-sha1/fb1c82582399043b149eb2630f524c75de9c88dc
Branch: androidx-master-dev
commit fb1c82582399043b149eb2630f524c75de9c88dc
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Aug 15 11:34:36 2019
Disallow intercept, touch slop and canScroll in nestedPreScroll
* Disallow intercept (requestDisallowInterceptTouchEvent(true))
When scroll delta is consumed by dispatchNestedPreScroll, the parent
should be requested not to intercept subsequent touch events, just as
when scroll is consumed by the widget itself or dispatchNestedScroll.
* Touch slop
NestedScrollingChild implementations should only call
dispatchNestedPreScroll after the delta x/y has exceeded the touch slop.
* canScroll (canScrollHorizontally/canScrollVertically)
The dx/dy values passed to dispatchNestedPreScroll should be zero if the
child can't scroll in that direction.
Fixed in:
- RecyclerView
- NestedScrollView
Bug: 138668210
Bug: 139530818
Test: ./gradlew connectedCheck
Change-Id: I85b327ad096fbbd204adb92f630770ec7fad5990
M core/core/src/androidTest/java/androidx/core/widget/NestedScrollViewNestedScrollingChildTest.java
M core/core/src/main/java/androidx/core/widget/NestedScrollView.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrolling3RequestDisallowInterceptTouchTest.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrollingChildTest.java
M recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
jg...@google.com <jg...@google.com>
jg...@google.com <jg...@google.com> #3
I confirm I managed to reproduce with API 23 emulator and the following patch on the sample app. Will investigate further.
Patch below.
***
Index: app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt (revision 38ea42c142729c777dcf8f3e4bd5100aeca981ec)
+++ app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt (date 1565281963000)
@@ -16,9 +16,11 @@
package androidx.viewpager2.integration.testapp.cards
+import android.text.SpannableStringBuilder
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.EditText
import android.widget.TextView
import androidx.annotation.ColorRes
@@ -28,7 +30,7 @@
/** Inflates and populates a [View] representing a [Card] */
class CardView(layoutInflater: LayoutInflater, container: ViewGroup?) {
val view: View = layoutInflater.inflate(R.layout.item_card_layout, container, false)
- private val textSuite: TextView
+ private val textSuite: EditText
private val textCorner1: TextView
private val textCorner2: TextView
@@ -42,7 +44,7 @@
* Updates the view to represent the passed in card
*/
fun bind(card: Card) {
- textSuite.text = card.suit
+ textSuite.text = SpannableStringBuilder(card.suit)
view.setBackgroundResource(getColorRes(card))
val cornerLabel = card.cornerLabel
Index: app/src/main/res/layout/item_card_layout.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/layout/item_card_layout.xml (revision 38ea42c142729c777dcf8f3e4bd5100aeca981ec)
+++ app/src/main/res/layout/item_card_layout.xml (date 1565281963000)
@@ -31,13 +31,15 @@
android:textAppearance="@android:style/TextAppearance.Large"
tools:text="A"/>
- <TextView
+ <EditText
android:id="@+id/label_center"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:inputType="text"
+ android:maxLines="1"
android:textAppearance="@android:style/TextAppearance.Large"
- tools:text="â™ "/>
+ tools:text="â™ " />
<TextView
android:id="@+id/label_bottom"
Patch below.
***
Index: app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt (revision 38ea42c142729c777dcf8f3e4bd5100aeca981ec)
+++ app/src/main/java/androidx/viewpager2/integration/testapp/cards/CardView.kt (date 1565281963000)
@@ -16,9 +16,11 @@
package androidx.viewpager2.integration.testapp.cards
+import android.text.SpannableStringBuilder
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.EditText
import android.widget.TextView
import androidx.annotation.ColorRes
@@ -28,7 +30,7 @@
/** Inflates and populates a [View] representing a [Card] */
class CardView(layoutInflater: LayoutInflater, container: ViewGroup?) {
val view: View = layoutInflater.inflate(R.layout.item_card_layout, container, false)
- private val textSuite: TextView
+ private val textSuite: EditText
private val textCorner1: TextView
private val textCorner2: TextView
@@ -42,7 +44,7 @@
* Updates the view to represent the passed in card
*/
fun bind(card: Card) {
- textSuite.text = card.suit
+ textSuite.text = SpannableStringBuilder(card.suit)
view.setBackgroundResource(getColorRes(card))
val cornerLabel = card.cornerLabel
Index: app/src/main/res/layout/item_card_layout.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/layout/item_card_layout.xml (revision 38ea42c142729c777dcf8f3e4bd5100aeca981ec)
+++ app/src/main/res/layout/item_card_layout.xml (date 1565281963000)
@@ -31,13 +31,15 @@
android:textAppearance="@android:style/TextAppearance.Large"
tools:text="A"/>
- <TextView
+ <EditText
android:id="@+id/label_center"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:inputType="text"
+ android:maxLines="1"
android:textAppearance="@android:style/TextAppearance.Large"
- tools:text="â™ "/>
+ tools:text="â™ " />
<TextView
android:id="@+id/label_bottom"
jg...@google.com <jg...@google.com> #4
Corrected video
jg...@google.com <jg...@google.com>
ap...@google.com <ap...@google.com> #5
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
Description
Device: Redmi4, Andoid 6.0.1
Steps:
1. Create ViewPager with RecyclerView adapter
2. Add single line EditText on page (android:layout_width="match_parent", android:layout_height="wrap_content", android:inputType="text", android:maxLines="1")
3. Enter a long text
4. Input initiate scroll to the next ViewPager screen
Reproduce only on Redmi4