Fixed
Status Update
Comments
su...@google.com <su...@google.com> #2
Hi, thanks for reporting, we'll have a look. If you could provide us with a minimum sample app to reproduce the issue, that'd be very helpful.
ch...@gmail.com <ch...@gmail.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"
[Deleted User] <[Deleted User]> #4
Corrected video
ro...@gmail.com <ro...@gmail.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
ch...@instacart.com <ch...@instacart.com> #8
Thanks Sumir!
Description
Version used: 1.0.0-alpha12
After upgrading to alpha12, all of my Workers written in Kotlin (and CoroutineWorkers, FWIW), complain about the 'Result' return value with an error that says: "One type argument expected for class Result<out T>"
It appears that the Kotlin standard library contains a public inline Result class already:
The Kotlin Result class is automatically available in every file, so Android Studio (3.2.1) doesn't offer to import the androidx.work.Result class, causing the error since it assumes you want to use the already available kotlin Result.
There were two workarounds, neither very friendly:
1) Use the fully qualified androidx.work.Result
2) Manually adding the androidx.work.Result import statement
Note that:
- Using the fully qualified name, then using the Android Studio option to add import did not work
- Removing the doWork method entirely and using Android Studio's quick fix to implement the method did add an import to androidx.work.Result, so new classes would avoid running into this issue.