-
public abstract class ZipCompressionCallback<T extends Object>Created on 02/01/22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classZipCompressionCallback.Reportpublic enumZipCompressionCallback.ErrorCode
-
Field Summary
Fields Modifier and Type Field Description private CoroutineScopeuiScope
-
Constructor Summary
Constructors Constructor Description ZipCompressionCallback(CoroutineScope uiScope)ZipCompressionCallback()
-
Method Summary
Modifier and Type Method Description final CoroutineScopegetUiScope()final UnitsetUiScope(CoroutineScope uiScope)UnitonCountingFiles()LongonStart(List<T> files, Thread workerThread)BooleanonCheckFreeSpace(Long freeSpace, Long fileSize)Given freeSpaceandfileSize, then you decide whether the process will be continued or not.UnitonReport(ZipCompressionCallback.Report report)UnitonDeleteEntryFiles()UnitonCompleted(DocumentFile zipFile, Long bytesCompressed, Integer totalFilesCompressed, Float compressionRate)UnitonFailed(ZipCompressionCallback.ErrorCode errorCode, String message)-
-
Method Detail
-
getUiScope
final CoroutineScope getUiScope()
-
setUiScope
final Unit setUiScope(CoroutineScope uiScope)
-
onCountingFiles
@UiThread() Unit onCountingFiles()
-
onStart
@UiThread() Long onStart(List<T> files, Thread workerThread)
- Parameters:
files- files to be compressed.workerThread- Use Thread.interrupt to cancel the operation
-
onCheckFreeSpace
@WorkerThread() Boolean onCheckFreeSpace(Long freeSpace, Long fileSize)
Given
freeSpaceandfileSize, then you decide whether the process will be continued or not. You can give space tolerant here, e.g. 100MB. This function will not be triggered when compressing MediaFile.- Parameters:
freeSpace- of target path
-
onReport
@UiThread() Unit onReport(ZipCompressionCallback.Report report)
-
onDeleteEntryFiles
@UiThread() Unit onDeleteEntryFiles()
-
onCompleted
@UiThread() Unit onCompleted(DocumentFile zipFile, Long bytesCompressed, Integer totalFilesCompressed, Float compressionRate)
- Parameters:
compressionRate- size reduction in percent, e.g.
-
onFailed
@UiThread() Unit onFailed(ZipCompressionCallback.ErrorCode errorCode, String message)
-
-
-
-