public class

AnimationBackendDelegateWithInactivityCheck

extends AnimationBackendDelegate<T extends AnimationBackend>
java.lang.Object
   ↳ com.facebook.fresco.animation.backend.AnimationBackendDelegate<T extends com.facebook.fresco.animation.backend.AnimationBackend>
     ↳ com.facebook.fresco.animation.backend.AnimationBackendDelegateWithInactivityCheck<T extends com.facebook.fresco.animation.backend.AnimationBackend>

Class Overview

Animation backend delegate for animation backends that implement AnimationBackendDelegateWithInactivityCheck.InactivityListener. After a certain inactivity period (default = #INACTIVITY_THRESHOLD_MS, onInactive() will be called.

This can for example be used to drop caches if needed.

New instances can be created with createForBackend(AnimationBackend, MonotonicClock, ScheduledExecutorService).

Summary

Nested Classes
interface AnimationBackendDelegateWithInactivityCheck.InactivityListener  
[Expand]
Inherited Constants
From interface com.facebook.fresco.animation.backend.AnimationBackend
From interface com.facebook.fresco.animation.backend.AnimationInformation
Public Methods
static <T extends AnimationBackend & AnimationBackendDelegateWithInactivityCheck.InactivityListener> AnimationBackendDelegate<T> createForBackend(T backend, MonotonicClock monotonicClock, ScheduledExecutorService scheduledExecutorServiceForUiThread)
static <T extends AnimationBackend> AnimationBackendDelegate<T> createForBackend(T backend, AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener, MonotonicClock monotonicClock, ScheduledExecutorService scheduledExecutorServiceForUiThread)
boolean drawFrame(Drawable parent, Canvas canvas, int frameNumber)
Draw the frame for the given frame number on the canvas.
long getInactivityCheckPollingTimeMs()
long getInactivityThresholdMs()
void setInactivityCheckPollingTimeMs(long inactivityCheckPollingTimeMs)
void setInactivityListener(AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener)
void setInactivityThresholdMs(long inactivityThresholdMs)
[Expand]
Inherited Methods
From class com.facebook.fresco.animation.backend.AnimationBackendDelegate
From class java.lang.Object
From interface com.facebook.fresco.animation.backend.AnimationBackend
From interface com.facebook.fresco.animation.backend.AnimationInformation

Public Methods

public static AnimationBackendDelegate<T> createForBackend (T backend, MonotonicClock monotonicClock, ScheduledExecutorService scheduledExecutorServiceForUiThread)

public static AnimationBackendDelegate<T> createForBackend (T backend, AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener, MonotonicClock monotonicClock, ScheduledExecutorService scheduledExecutorServiceForUiThread)

public boolean drawFrame (Drawable parent, Canvas canvas, int frameNumber)

Draw the frame for the given frame number on the canvas.

Parameters
parent the parent that draws the frame
canvas the canvas to draw an
frameNumber the frame number of the frame to draw
Returns
  • true if successful, false if the frame could not be rendered

public long getInactivityCheckPollingTimeMs ()

public long getInactivityThresholdMs ()

public void setInactivityCheckPollingTimeMs (long inactivityCheckPollingTimeMs)

public void setInactivityListener (AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener)

public void setInactivityThresholdMs (long inactivityThresholdMs)