Skip to content

//readium-shared/org.readium.r2.shared.publication/Locator

Locator

[androidJvm]\ data class Locator(val href: String, val type: String, 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

Locator [androidJvm]
fun Locator(href: String, type: String, title: String? = null, locations: Locator.Locations = Locations(), text: Locator.Text = Text())

Types

Name Summary
Companion [androidJvm]
object Companion
Locations [androidJvm]
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
Text [androidJvm]
data class Text(val before: String? = null, val highlight: String? = null, val after: String? = null) : JSONable, Parcelable
Textual context of the locator.

Functions

Name Summary
copyWithLocations [androidJvm]
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.
describeContents [androidJvm]
abstract fun describeContents(): Int
toJSON [androidJvm]
open override fun toJSON(): JSONObject
Serializes the object to its JSON representation.
writeToParcel [androidJvm]
abstract fun writeToParcel(p0: Parcel, p1: Int)

Properties

Name Summary
href [androidJvm]
val href: String
locations [androidJvm]
val locations: Locator.Locations
text [androidJvm]
val text: Locator.Text
title [androidJvm]
val title: String? = null
type [androidJvm]
val type: String