-
- All Implemented Interfaces:
-
app.rive.runtime.kotlin.core.RefCount
public abstract class FileAssetLoader extends NativeObject
Base class for asset loading. Overload loadContents to customize the loading process.
This allows you to choose how assets, i.e. images, fonts, and audio, are loaded when referenced by a Rive file. This is especially useful for referenced assets which you may want to load once and supply to multiple Rive files, e.g. for expensive font files.
Asset loaders are typed to a specific RendererType via setRendererType. This is because images are renderer specific, and the asset loader is ultimately what creates FileAssets.
Apply it to a RiveAnimationView in one of the following ways:
File constructor
RiveFileRequest constructor
Via the XML attribute
riveAssetLoaderClassas the class name using reflection
-
-
Field Summary
Fields Modifier and Type Field Description private final BooleanhasCppObjectprivate AtomicIntegerrefsprivate LongcppPointerprivate final List<RefCount>dependenciesprivate final IntegerrefCount
-
Constructor Summary
Constructors Constructor Description FileAssetLoader()
-
Method Summary
Modifier and Type Method Description final BooleangetHasCppObject()final AtomicIntegergetRefs()final UnitsetRefs(AtomicInteger refs)final LonggetCppPointer()final UnitsetCppPointer(Long cppPointer)final List<RefCount>getDependencies()IntegergetRefCount()UnitcppDelete(Long pointer)final UnitcppRef(Long pointer)abstract BooleanloadContents(FileAsset asset, ByteArray inBandBytes)Override to customize the asset loading process. final UnitsetRendererType(RendererType rendererType)Integeracquire()Increments the references for this counter. -
-
Method Detail
-
getHasCppObject
final Boolean getHasCppObject()
-
getRefs
final AtomicInteger getRefs()
-
setRefs
final Unit setRefs(AtomicInteger refs)
-
getCppPointer
final Long getCppPointer()
-
setCppPointer
final Unit setCppPointer(Long cppPointer)
-
getDependencies
final List<RefCount> getDependencies()
-
getRefCount
Integer getRefCount()
-
loadContents
abstract Boolean loadContents(FileAsset asset, ByteArray inBandBytes)
Override to customize the asset loading process.
- Parameters:
asset- The FileAsset being loaded.inBandBytes- The embedded bytes that were included in the Rive file.
-
setRendererType
final Unit setRendererType(RendererType rendererType)
-
-
-
-