Fixed
Status Update
Comments
ma...@google.com <ma...@google.com>
nj...@google.com <nj...@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!
lc...@gmail.com <lc...@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
ya...@google.com <ya...@google.com>
ap...@google.com <ap...@google.com> #5
deleted
lc...@gmail.com <lc...@gmail.com> #6
Am i missing something? I tried compose animation graphics version 1.2.0-beta01. However my avd (in #1) is still not repeating/looping infinitely. Am i doing anything wrong?
val image = AnimatedImageVector.animatedVectorResource(id)
val atEnd = remember { mutableStateOf(false) }
SideEffect {
atEnd.value = true
}
Image(
painter = rememberAnimatedVectorPainter(image, atEnd.value),
modifier = Modifier
.wrapContentSize(align = Alignment.Center),
contentDescription = null
)
lc...@gmail.com <lc...@gmail.com> #7
It seems that compose animatedVectorImage still does not support infinitely repeating animations. I may be wrong but from this piece of code in the androidx.compose.animation.graphics.vector.Animator
class. This function seems to only make the animation repeatable if the repeatCount is > 0.
internal class Timestamp<T>(
val timeMillis: Int,
val durationMillis: Int,
val repeatCount: Int,
val repeatMode: RepeatMode,
val holder: PropertyValuesHolder<T>
) {
fun asAnimationSpec(): FiniteAnimationSpec<T> {
@Suppress("UNCHECKED_CAST")
val spec = when (holder) {
is PropertyValuesHolderFloat -> holder.asKeyframeSpec(durationMillis)
is PropertyValuesHolderColor -> holder.asKeyframeSpec(durationMillis)
else -> throw RuntimeException("Unexpected value type: $holder")
} as KeyframesSpec<T>
return if (repeatCount > 0) {
repeatable(
iterations = repeatCount + 1,
animation = spec,
repeatMode = repeatMode
)
} else {
spec
}
}
}
However for xml avd, repeatcount is infinitely repeatable if the repeatCount is -1 which causes the animation to not repeat at all.
<!-- Defines how many times the animation should repeat. The default value is 0. -->
<attr name="repeatCount" format="integer">
<enum name="infinite" value="-1" />
</attr>
lc...@gmail.com <lc...@gmail.com> #8
created another issue here
an...@sigma.software <an...@sigma.software> #9
This is not fixed. I have a complex animation set with multiple sequential object animators, and it's impossible to loop the animation.
Description
Component used: androidx.compose.animation:animation-graphics
Version used: 1.1.0-alpha03
Devices/Android versions reproduced on: all devices and android versions
If this is a bug in the library, we would appreciate if you could attach:
Don't think this is a bug, more like a feature gap?
Code snippet of my avd composable
Avd repeating animations are not repeating, and looks like the current painter api also does not support this use case. Does not seem to respect the avd's
android:repeatCount="-1"
attribute. Avd used to replicate "issue" attached.