Locator

data class Locator(val href: Url, val mediaType: MediaType, val title: String? = null, val locations: Locator.Locations = Locations(), val text: Locator.Text = Text()) : JSONable, Parcelable

Represents a precise location in a publication in a format that can be stored and shared.

There are many different use cases for locators:

  • getting back to the last position in a publication

  • bookmarks

  • highlights & annotations

  • search results

  • human-readable (and shareable) reference in a publication

https://readium.org/architecture/models/locators/

Constructors

Link copied to clipboard
constructor(href: Url, mediaType: MediaType, title: String? = null, locations: Locator.Locations = Locations(), text: Locator.Text = Text())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Locations(val fragments: List<String> = emptyList(), val progression: Double? = null, val position: Int? = null, val totalProgression: Double? = null, val otherLocations: Map<String, Any> = emptyMap()) : JSONable, Parcelable

One or more alternative expressions of the location. https://github.com/readium/architecture/tree/master/models/locators#the-location-object

Link copied to clipboard
data class Text(val before: String? = null, val highlight: String? = null, val after: String? = null) : JSONable, Parcelable

Textual context of the locator.

Properties

Link copied to clipboard
val href: Url
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copyWithLocations(fragments: List<String> = locations.fragments, progression: Double? = locations.progression, position: Int? = locations.position, totalProgression: Double? = locations.totalProgression, otherLocations: Map<String, Any> = locations.otherLocations): Locator

Shortcut to get a copy of the Locator with different Locations sub-properties.

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard
open override fun toJSON(): JSONObject

Serializes the object to its JSON representation.

Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)