Module: Toybox.Application.DynamicResource
Overview
The Dynamic Resource module provides APIs for loading resources from dynamic sources.
Constant Summary
-
Status
-
Type
-
ImageFormat
Represents the result status of an asynchronous build operation, such as one used for persisted content.
| Name | Value | Since | Description |
|---|---|---|---|
| STATUS_SUCCESS | 0 | API Level 6.0.3 |
|
| STATUS_ERROR | 1 | API Level 6.0.3 |
The type of dynamic resource being loaded.
| Name | Value | Since | Description |
|---|---|---|---|
| TYPE_IMAGE | 0 | API Level 6.0.3 |
Image dynamic resource type, expected resource type after loading is [Toybox::Graphics::BitmapResource]. |
| TYPE_PERSISTED_CONTENT | 2 | API Level 6.0.3 |
Persisted content resource, e.g. FIT, GPX files, expected return type after 'build' is a [Toybox::Application::DynamicResource::PersistedContentCallback] to receive the content asynchronously after the content is persisted on the device. |
| TYPE_AUDIO | 3 | API Level 6.0.3 |
Audio dynamic resource type, expected resource type after loading is [Toybox::Audio::DynamicAudioSource]. format is mandatory for this type and should be specified with Audio.ContainerFormat values. |
Image formats that can be specified when loading image dynamic resources.
| Name | Value | Since | Description |
|---|---|---|---|
| IMAGE_FORMAT_PNG | 0 | API Level 6.0.3 |
|
| IMAGE_FORMAT_JPEG | 1 | API Level 6.0.3 |
|
| IMAGE_FORMAT_GIF | 2 | API Level 6.0.3 |
First frame of GIF will loaded as BitmapResource. |
Typedef Summary collapse
-
Options as { :type as DynamicResource.Type, :format as Audio.ContainerFormat or DynamicResource.ImageFormat or Null, :data as Lang.ByteArray, :callback as DynamicResource.PersistedContentCallback or Null }
Dynamic Resource Options.
-
PersistedContentCallback as Lang.Method(content as { :status as DynamicResource.Status, :iterator as PersistedContent.Iterator or Null, :count as Lang.Number or Null }) as Void
Persisted content callback to receive the result of a persisted content build operation.
Instance Method Summary collapse
-
build(options as DynamicResource.Options) as WatchUi.BitmapResource or Output.DynamicAudioSource or Null
Load a dynamic resource.
Typedef Details
Options as { :type as DynamicResource.Type, :format as Audio.ContainerFormat or DynamicResource.ImageFormat or Null, :data as Lang.ByteArray, :callback as DynamicResource.PersistedContentCallback or Null }
Dynamic Resource Options
PersistedContentCallback as Lang.Method(content as { :status as DynamicResource.Status, :iterator as PersistedContent.Iterator or Null, :count as Lang.Number or Null }) as Void
Persisted content callback to receive the result of a persisted content build operation.
Instance Method Details
build(options as DynamicResource.Options) as WatchUi.BitmapResource or Output.DynamicAudioSource or Null
Load a dynamic resource.