Package com.castlabs.android.player

# Class Chapter

java.lang.Object
com.castlabs.android.player.Chapter

public class Chapter extends Object
Basic chapter model that consists of the chapter position, a title, and an image URL. Both, the title and the image URL are optional.

Since:
  2.0.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final Uri`
  `imageUrl`
  (Optional) URI to an image
  `final long`
  `positionMs`
  The chapter position in milliseconds
  `final String`
  `title`
  (Optional) title

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Chapter(long position)`
  Create a new chapter
  `Chapter(long positionMs, long endPositionMs, String title, Uri imageUrl)`
  Create a new chapter
  `Chapter(long position, String title)`
  Create a new chapter
  `Chapter(long positionMs, String title, Uri imageUrl)`
  Create a new chapter

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getEndPositionMs()`
  Returns the end position of the chapter in milliseconds.
  `boolean`
  `isHighlighted()`
  Returns whether the chapter is highlighted.
  `boolean`
  `isShown(long positionMs)`
  Returns whether the chapter is shown at the given position.
  `void`
  `setEndPositionMs(long endPositionMs)`
  Sets the end position of the chapter in milliseconds.
  `void`
  `setHighlighted(boolean highlighted)`
  Sets whether the chapter is highlighted.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### positionMs

    public final long positionMs
    The chapter position in milliseconds

  - ### title

    @Nullable public final String title
    (Optional) title

  - ### imageUrl

    @Nullable public final Uri imageUrl
    (Optional) URI to an image

- ## Constructor Details

  - ### Chapter

    public Chapter(long position)
    Create a new chapter
    Parameters:
      `position` - the chapter position

  - ### Chapter

    public Chapter(long position, String title)
    Create a new chapter
    Parameters:
      `position` - the chapter position in milliseconds
      `title` - the chapter title

  - ### Chapter

    public Chapter(long positionMs, String title, Uri imageUrl)
    Create a new chapter
    Parameters:
      `positionMs` - the position of the chapter start in ms
      `title` - the title (optional)
      `imageUrl` - the image url (optional)

  - ### Chapter

    public Chapter(long positionMs, long endPositionMs, String title, Uri imageUrl)
    Create a new chapter
    Parameters:
      `positionMs` - the position of the chapter start in ms
      `endPositionMs` - the end position in ms or -1
      `title` - the title (optional)
      `imageUrl` - the image url (optional)

- ## Method Details

  - ### getEndPositionMs

    public long getEndPositionMs()
    Returns the end position of the chapter in milliseconds.
    Returns:
      The end position of the chapter in milliseconds.

  - ### setEndPositionMs

    public void setEndPositionMs(long endPositionMs)
    Sets the end position of the chapter in milliseconds.
    Parameters:
      `endPositionMs` - The end position of the chapter in milliseconds.

  - ### isHighlighted

    public boolean isHighlighted()
    Returns whether the chapter is highlighted.
    Returns:
      True if the chapter is highlighted, false otherwise.

  - ### setHighlighted

    public void setHighlighted(boolean highlighted)
    Sets whether the chapter is highlighted.
    Parameters:
      `highlighted` - True if the chapter is highlighted, false otherwise.

  - ### isShown

    public boolean isShown(long positionMs)
    Returns whether the chapter is shown at the given position.
    Parameters:
      `positionMs` - The position in milliseconds.
    Returns:
      True if the chapter is shown at the given position, false otherwise.