Fixed
Status Update
Comments
gr...@google.com <gr...@google.com> #2
Hi, thanks for reporting. Should be an easy fix!
I'm guessing it should work find until ~ 2^23 items = ~ 8M items. How did you come across this bug? Do you have a ViewPager2 with that many items?
I'm guessing it should work find until ~ 2^23 items = ~ 8M items. How did you come across this bug? Do you have a ViewPager2 with that many items?
gr...@google.com <gr...@google.com> #3
Hi, good to hear that.
We have an implementation of RecyclerView.Adapter that supports "infinite looping". So when the infinite looping is enabled, the adapter's getItemCount() reports Int.MAX_VALUE items. We also call setCurrentItem to somewhere in the middle of item count on the ViewPager2, so that's how we got that far.
We have an implementation of RecyclerView.Adapter that supports "infinite looping". So when the infinite looping is enabled, the adapter's getItemCount() reports Int.MAX_VALUE items. We also call setCurrentItem to somewhere in the middle of item count on the ViewPager2, so that's how we got that far.
se...@google.com <se...@google.com>
se...@google.com <se...@google.com> #4
For future reference: first item for which it fails is probably when mCurrentItem = (1 << 25) + 2
se...@google.com <se...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 2e9f35536432bed0677171c8ae59b4f67850915a
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jul 12 14:26:10 2019
Use double instead of float for decimal positions
A position ranges from 0 to Integer.MAX_VALUE, but floats only have a 23
bit mantissa. Values over 2^23 are rounded to a nearby value.
Solve this by using double instead of float when we need to represent a
position with a fractional component. A double has a mantissa of 52 bit
and can therefore represent all 2^32 possible int values.
Bug: 134858960
Test: ./gradlew viewpager2:cC
Change-Id: I08b97df6fac600caa83366ccab8671541e2c1e7f
A viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/SparseAdapter.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/OffscreenPageLimitTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageChangeCallbackTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/SetItemWhileScrollInProgressTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
https://android-review.googlesource.com/1014538
https://goto.google.com/android-sha1/2e9f35536432bed0677171c8ae59b4f67850915a
Branch: androidx-master-dev
commit 2e9f35536432bed0677171c8ae59b4f67850915a
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Jul 12 14:26:10 2019
Use double instead of float for decimal positions
A position ranges from 0 to Integer.MAX_VALUE, but floats only have a 23
bit mantissa. Values over 2^23 are rounded to a nearby value.
Solve this by using double instead of float when we need to represent a
position with a fractional component. A double has a mantissa of 52 bit
and can therefore represent all 2^32 possible int values.
Bug: 134858960
Test: ./gradlew viewpager2:cC
Change-Id: I08b97df6fac600caa83366ccab8671541e2c1e7f
A viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/SparseAdapter.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/OffscreenPageLimitTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageChangeCallbackTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/PageTransformerTest.kt
M viewpager2/src/androidTest/java/androidx/viewpager2/widget/SetItemWhileScrollInProgressTest.kt
M viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
M viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
se...@google.com <se...@google.com>
se...@google.com <se...@google.com> #7
That issue is a little bit different
We don't do any draw time istantiation of font axes.
You can get the behavior you expect by defining multiple instances of the font. One for each font weight that you want to support. You can put them in a FontFamily, and then matching is done by (FontWeight, Style)
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-main
Author: Sean McQuillan <
Link:
Don't allow Paint to cache variation settings of resource fonts
Expand for full commit details
Don't allow Paint to cache variation settings of resource fonts
Prev: Loading two resource fonts with the same variation settings would cause the variation settings to not be applied to the second font.
New: Paint cache is invalidated during font load path.
Fixes: b/372044241
Test: manual of variable font demo
Relnote: "Resource fonts with the same variation settings will now avoid over-caching causing the incorrect variation settings to be applied."
Change-Id: If3dff4ea44e33b1ed80bc7fb5057923a088f1678
Files:
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/PlatformTypefaces.android.kt
Hash: 8ad5f10469c5a044be4fd8a90fc19c5614f61734
Date: Tue Oct 15 16:25:26 2024
pr...@google.com <pr...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui-text:1.8.0-alpha08
androidx.compose.ui:ui-text-android:1.8.0-alpha08
androidx.compose.ui:ui-text-jvmstubs:1.8.0-alpha08
androidx.compose.ui:ui-text-linuxx64stubs:1.8.0-alpha08
Description
- Jetpack Compose component used: FontVariation
- Android Studio Build: Build #AI-241.18034.62.2412.12266719, built on August 23, 2024
- Kotlin version: 1.9.0, 2.0.20
- Devices/Android versions reproduced on: Pixel 8 Pro API 35 emulator
- Keyboard (i.e. Gboard, Samsung, etc): Gboard
- Sample project to trigger the issue:
A screen recording was attached.
Description of the minimal example:
I'm using two variable fonts: Azeret Mono and Roboto Mono.
For each font I created a map containing 4 different font weights(100, 200, 300, 400). I'm persisting this weight info along with the font index in a DataStore.
Using a slider and a menu I'm changing the style of a Text.
Observed behavior:
- negative case:
When I open the app and change the font from Azeret(200) to Roboto(200) the displayed style is Roboto(400) instead. Similar behavior can be observed with other configurations too.
- positive case:
When I open the app and play around with the slider first and then change the font, everything looks fine.