Assigned
Status Update
Comments
sp...@google.com <sp...@google.com> #2
I face with the same problem. I have different pageMargin in landscape and portrait and when viewpager is scrolled for the more than first position, after rotating device it is shifted.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
js...@gmail.com <js...@gmail.com> #3
[Comment deleted]
sp...@google.com <sp...@google.com> #4
I found the same problem in suport library v4, wrong align happens only when ViewPager has a page margin > 0.
js...@gmail.com <js...@gmail.com> #6
The issue is still reproducible in support library v4 (rev. 18).
I managed to fix the issue by importing the source code of ViewPager in my project and modifying from onSizeChanged method the following line:
From:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
To:
if (w != oldw) {
recomputeScrollPosition(w, oldw, 0, 0);
}
I managed to fix the issue by importing the source code of ViewPager in my project and modifying from onSizeChanged method the following line:
From:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
To:
if (w != oldw) {
recomputeScrollPosition(w, oldw, 0, 0);
}
sp...@google.com <sp...@google.com>
sp...@google.com <sp...@google.com> #7
I use this little wrapper as a work around for the bug:
ublic class FixedViewPager extends ViewPager {
public FixedViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FixedViewPager(Context context) {
super(context);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w-this.getPageMargin(), h, oldw-this.getPageMargin(), oldh);
}
}
ublic class FixedViewPager extends ViewPager {
public FixedViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FixedViewPager(Context context) {
super(context);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w-this.getPageMargin(), h, oldw-this.getPageMargin(), oldh);
}
}
au...@google.com <au...@google.com> #8
Thanks for posting the workaround. Works great. Can't believe this issue still exists after almost 2 years since it's been reported.
Description
Sample Project: Google Authenticator App (or any app that require biometric)
Bug occurs in both libraries:
1.) androidx.biometric:biometric.ktx
2.) androidx.biometric:biometri
Build Information:
Device: Pixel 7
OS Version: Android 15
Security Patch Level: July 5, 2024
Build Number: AP31.240617.010
Biometric Library Version: 1.1.0 or 1.4.0-alpha01 (either)
Steps to Reproduce:
Prerequisite: Ensure the phone has a PIN set up.
1. Open the Google Authenticator app and enable the "Privacy Screen" in the settings
2. Close and reopen the app to display the "Biometric" authentication screen
3. Enter the correct PIN and tap the "Next" icon on the keyboard
4. Proper timing is crucial at this step—rotate the phone immediately after tapping "Next" to reproduce the issue accurately
Expected Behavior: After successful authentication, the user is taken to the next screen.
Actual Behavior: An empty "Biometric" screen appears with only the PIN entry field visible and no text. Pressing the back button navigates to the correct screen without requiring further authentication (as the user is already authenticated).
Duo FLAG_SECURE screen couldn't be recorded.