Interface LibraryManager
-
public interface LibraryManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceLibraryManager.DeleteItemListenerThe interface that should be implemented to listen for completion ofdeleteItem(String, DeleteItemListener).static interfaceLibraryManager.GetItemListenerThe interface that should be implemented to listen for completion ofgetItem(String, GetItemListener).static interfaceLibraryManager.GetItemsListenerstatic interfaceLibraryManager.ListenerThe interface that should be implemented to listen for modifications of the library.static interfaceLibraryManager.SetItemLockStateListenerThe interface that should be implemented to listen for completion ofsetItemLockState(String, LibraryItemLockState, SetItemLockStateListener).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(LibraryManager.Listener listener)Adds a listener that will be notified when the library is modified.voiddeleteItem(LibraryItem item, LibraryManager.DeleteItemListener listener)voiddeleteItem(java.lang.String id, LibraryManager.DeleteItemListener listener)voidgetItem(java.lang.String id, LibraryManager.GetItemListener listener)Fetches an item by its identifier.voidgetItems(LibraryItemFilterType filter, LibraryItemOrderByField orderByField, boolean sortAscending, LibraryManager.GetItemsListener listener)Fetches a list of items matching the specified criteria.androidx.documentfile.provider.DocumentFilegetLibraryPath()longgetLibrarySize()longgetMaxDiskUsage()longgetRemainingSpace()Returns the amount of space remaining for library items, taking the value returned fromgetMaxDiskUsage()into account.voidremoveListener(LibraryManager.Listener listener)Removes the specified listener.voidsetItemLockState(LibraryItem item, LibraryItemLockState lockState, LibraryManager.SetItemLockStateListener listener)Sets the lock state of the specified item.voidsetItemLockState(java.lang.String id, LibraryItemLockState lockState, LibraryManager.SetItemLockStateListener listener)Sets the lock state of the specified item.voidsetLibraryPath(androidx.documentfile.provider.DocumentFile path)Sets the path to the library.voidsetMaxDiskUsage(long maxDiskUsageBytes)Sets the maximum disk space the library is allowed to use.
-
-
-
Method Detail
-
getMaxDiskUsage
long getMaxDiskUsage()
- Returns:
- The maximum disk usage in bytes.
- See Also:
setMaxDiskUsage(long)
-
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 java.io.IOExceptionSets the path to the library.- Parameters:
path- The path.- Throws:
java.io.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 fromgetMaxDiskUsage()into account.- Returns:
- The remaining space in bytes.
-
getItem
void getItem(java.lang.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(java.lang.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(java.lang.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.
-
-