Interface LibraryManager


public interface LibraryManager
  • Method Details

    • getMaxDiskUsage

      long getMaxDiskUsage()
      Returns:
      The maximum disk usage in bytes.
      See Also:
    • setMaxDiskUsage

      void setMaxDiskUsage(long maxDiskUsageBytes)
      Sets the maximum disk space the library is allowed to use.

      When total size of all library items reaches this value, old unlocked items will be automatically removed.

      Parameters:
      maxDiskUsageBytes - Maximum disk space in bytes.
    • getLibraryPath

      androidx.documentfile.provider.DocumentFile getLibraryPath()
      Returns:
      The path to the library.
    • setLibraryPath

      void setLibraryPath(androidx.documentfile.provider.DocumentFile path) throws IOException
      Sets the path to the library.
      Parameters:
      path - The path.
      Throws:
      IOException - The library couldn't be initialized using the specified path.
    • addListener

      void addListener(LibraryManager.Listener listener)
      Adds a listener that will be notified when the library is modified.
      Parameters:
      listener - The listener.
    • removeListener

      void removeListener(LibraryManager.Listener listener)
      Removes the specified listener.
      Parameters:
      listener - The listener.
    • getLibrarySize

      long getLibrarySize()
      Returns:
      Total size of all videos and images in bytes.
    • getRemainingSpace

      long getRemainingSpace()
      Returns the amount of space remaining for library items, taking the value returned from getMaxDiskUsage() into account.
      Returns:
      The remaining space in bytes.
    • getItem

      void getItem(String id, LibraryManager.GetItemListener listener)
      Fetches an item by its identifier.
      Parameters:
      id - The identifier of the item.
      listener - The listener to call on completion.
    • getItems

      void getItems(LibraryItemFilterType filter, LibraryItemOrderByField orderByField, boolean sortAscending, LibraryManager.GetItemsListener listener)
      Fetches a list of items matching the specified criteria.
      Parameters:
      filter - The filter to apply to the items.
      orderByField - The field that will be used to order the items.
      sortAscending - True if the items should be sorted in ascending order, false otherwise.
      listener - The listener to call on completion.
    • deleteItem

      void deleteItem(String id, LibraryManager.DeleteItemListener listener)
      Parameters:
      id - The identifier of the item.
      listener - The listener to call on completion.
    • deleteItem

      void deleteItem(LibraryItem item, LibraryManager.DeleteItemListener listener)
      Parameters:
      item -
      listener - The listener to call on completion.
    • setItemLockState

      void setItemLockState(String id, LibraryItemLockState lockState, LibraryManager.SetItemLockStateListener listener)
      Sets the lock state of the specified item.
      Parameters:
      id - The id of the item.
      lockState - The lock state to set.
      listener - The listener to call on completion.
    • setItemLockState

      void setItemLockState(@NonNull LibraryItem item, LibraryItemLockState lockState, LibraryManager.SetItemLockStateListener listener)
      Sets the lock state of the specified item.
      Parameters:
      item -
      lockState - The lock state to set.
      listener - The listener to call on completion.