Assigned
Status Update
Comments
ca...@google.com <ca...@google.com> #2
Hi, thanks for reporting.
As a temporary workaround, you can probably:
- unregister your margin transformer
- register a MarginPageTransformer with an offset of 0
- viewpager2.requestTransform()
- viewpager2.adapter.notifyItemInserted()
- revert back to the original transformer
It should be indistinguishible from the user perspective when done while viewPager.getScrollState() == SCROLL_STATE_IDLE (at that stage, there is no visible offset).
If it's not there, OnPageChangeCallback will notify you once the viewpager changes to SCROLL_STATE_IDLE.
Alternatively, if you don't want the animation, a notifyDatasetChanged() should work fine. Especially if you're using Fragments, as they will be kept around.
Apologies for the extra steps. We'll look into it!
As a temporary workaround, you can probably:
- unregister your margin transformer
- register a MarginPageTransformer with an offset of 0
- viewpager2.requestTransform()
- viewpager2.adapter.notifyItemInserted()
- revert back to the original transformer
It should be indistinguishible from the user perspective when done while viewPager.getScrollState() == SCROLL_STATE_IDLE (at that stage, there is no visible offset).
If it's not there, OnPageChangeCallback will notify you once the viewpager changes to SCROLL_STATE_IDLE.
Alternatively, if you don't want the animation, a notifyDatasetChanged() should work fine. Especially if you're using Fragments, as they will be kept around.
Apologies for the extra steps. We'll look into it!
ha...@gmail.com <ha...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f3df487541c41b9b0e81199a73eaeda058cab7a9
Author: Jakub Gielzak <jgielzak@google.com>
Date: Thu Aug 01 22:20:00 2019
Fix for PageTransformer + dataSet animations clash
Suspends data-set change animations in the presence of a
PageTransformer.
Bug: 134658996
Test: ./gradlew viewpager2:connectedCheck
Change-Id: I873f7233a87b553ef6f410a76b35e6567bd4dc80
A viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerItemAnimatorTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1095609
https://goto.google.com/android-sha1/f3df487541c41b9b0e81199a73eaeda058cab7a9
Branch: androidx-master-dev
commit f3df487541c41b9b0e81199a73eaeda058cab7a9
Author: Jakub Gielzak <jgielzak@google.com>
Date: Thu Aug 01 22:20:00 2019
Fix for PageTransformer + dataSet animations clash
Suspends data-set change animations in the presence of a
PageTransformer.
Bug: 134658996
Test: ./gradlew viewpager2:connectedCheck
Change-Id: I873f7233a87b553ef6f410a76b35e6567bd4dc80
A viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerItemAnimatorTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
Description
Expected Behavior:
If the API replaces an incorrect component (e.g., "NJ" → "TX"), the confirmation level should be "CONFIRMED" or a different status that reflects the correction.
Actual Behavior:
The administrative area is replaced ('replaced': True), but it is still marked as 'UNCONFIRMED_BUT_PLAUSIBLE', leading to potential confusion.
Steps to Reproduce:
Call the Google Address Validation API with the following address:
"6980 PARK Slope Tyler NJ 75703"
Observe that "NJ" is replaced with "TX" ('replaced': True).
Note that despite the replacement, the confirmation level remains 'UNCONFIRMED_BUT_PLAUSIBLE'.
API Response Snippet (Relevant Part):
{
"componentName": {"text": "TX", "languageCode": "en"},
"componentType": "administrative_area_level_1",
"confirmationLevel": "UNCONFIRMED_BUT_PLAUSIBLE",
"replaced": True
}
Question:
Shouldn't a replaced component be marked as "CONFIRMED" or another appropriate status instead of "UNCONFIRMED_BUT_PLAUSIBLE"?
Note:
Please address this issue in a more generic way rather than for this specific address, ensuring that the fix applies to all similar cases where a replaced component still appears as "Unconfirmed but Plausible."