FallbackAssetLoader

class FallbackAssetLoader(context: Context, loadCDNAssets: Boolean = true, loader: FileAssetLoader? = null) : FileAssetLoader

The default asset loader used by RiveAnimationView when loading assets. This allows for setting up cascading asset loaders which may be useful when each represents a different source or policy, e.g. a memory cache, local storage, and network.

Parameters

context

The application context.

loadCDNAssets

Whether to load assets from Rive's CDN. This appends a CDNAssetLoader to the list of loaders if true (default), allowing loading of assets marked as "Hosted" in the Rive editor.

loader

An optional initial FileAssetLoader to add to the list of loaders.

Constructors

Link copied to clipboard
constructor(context: Context, loadCDNAssets: Boolean = true, loader: FileAssetLoader? = null)

Properties

Link copied to clipboard

Getter/Setter for the underlying C++ pointer value.

Link copied to clipboard
Link copied to clipboard

Whether this objects underlying pointer is still valid.

Link copied to clipboard
Link copied to clipboard
open val refCount: Int
Link copied to clipboard
override var refs: AtomicInteger

Functions

Link copied to clipboard
open override fun acquire(): Int

Increments the references for this counter. Cannot be used for initialization - use refs.incrementAndGet instead.

Link copied to clipboard

Add a FileAssetLoader to the end of the list of loaders, i.e. lowest priority. Note that if the constructor parameter loadCDNAssets is true (default) a CDNAssetLoader will be the current last loader, and this will be added after it.

Link copied to clipboard
open external override fun cppDelete(pointer: Long)
Link copied to clipboard
external fun cppRef(pointer: Long)
Link copied to clipboard
open override fun loadContents(asset: FileAsset, inBandBytes: ByteArray): Boolean

Attempts to load the asset using each loader in order until one succeeds or all refuse.

Link copied to clipboard

Add a FileAssetLoader to the start of the list of loaders, i.e. highest priority.

Link copied to clipboard
open override fun release(): Int

Decrements the reference counter.

Link copied to clipboard
fun setRendererType(rendererType: RendererType)