Skip to content

Commit ec55b15

Browse files
Andres Portillo Chacónmeta-codesync[bot]
authored andcommitted
hero time
Differential Revision: D86889548 fbshipit-source-id: 545aa73ffab385c2ffaeffa419474cf7c40a605c
1 parent 3f2c073 commit ec55b15

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

vito/litho-slideshow/src/main/java/com/facebook/fresco/vito/litho/slideshow/FrescoVitoSlideshowComponentSpec.kt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import java.util.TimerTask
3636
object FrescoVitoSlideshowComponentSpec {
3737

3838
@PropDefault const val isPlaying = true
39+
@PropDefault const val isAlternativeTimerLogicEnable = false
3940

4041
@JvmStatic
4142
@OnCreateInitialState
@@ -73,6 +74,7 @@ object FrescoVitoSlideshowComponentSpec {
7374
@Prop(optional = true) callerContext: Any?,
7475
@Prop(optional = true) imageListener: ImageListener?,
7576
@TreeProp contextChain: ContextChain?,
77+
@Prop(optional = true) isAlternativeTimerLogicEnable: Boolean?,
7678
@State(canUpdateLazily = true) slideshowIndex: Int,
7779
@State(canUpdateLazily = true) timer: Timer,
7880
@State(canUpdateLazily = true) currentlyPlaying: Boolean,
@@ -157,11 +159,19 @@ object FrescoVitoSlideshowComponentSpec {
157159
}
158160
}
159161
slideshowDrawable.timerTask = timerTask
160-
timer.scheduleAtFixedRate(
161-
timerTask,
162-
photoTransitionMs.toLong(),
163-
(photoTransitionMs + fadeTransitionMs).toLong(),
164-
)
162+
if (isAlternativeTimerLogicEnable == true && heroMediaTransitionMs != null) {
163+
timer.scheduleAtFixedRate(
164+
timerTask,
165+
heroMediaTransitionMs.toLong(),
166+
(photoTransitionMs + fadeTransitionMs).toLong(),
167+
)
168+
} else {
169+
timer.scheduleAtFixedRate(
170+
timerTask,
171+
photoTransitionMs.toLong(),
172+
(photoTransitionMs + fadeTransitionMs).toLong(),
173+
)
174+
}
165175
} else if (!isPlaying && currentlyPlaying) {
166176
val animateTask = slideshowDrawable.timerTask
167177
animateTask?.cancel()

0 commit comments

Comments
 (0)