-
public abstract class FolderCallback extends BaseFileCallback<FolderCallback.ErrorCode, FolderCallback.Report, FolderCallback.Result>
Created on 3/1/21
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classFolderCallback.ParentFolderConflictActionpublic final classFolderCallback.FolderContentConflictActionpublic enumFolderCallback.ConflictResolutionpublic final classFolderCallback.FileConflictpublic enumFolderCallback.ErrorCodepublic final classFolderCallback.ReportOnly called if the returned onStart greater than
0public final classFolderCallback.ResultIf
totalCopiedFilesare less thantotalFilesToCopy, then some files cannot be copied/moved or the files are skipped due to ConflictResolution.MERGE can be called before BaseFileCallback.onCompleted when an error has occurred.
-
Field Summary
Fields Modifier and Type Field Description private CoroutineScopeuiScope
-
Constructor Summary
Constructors Constructor Description FolderCallback(CoroutineScope uiScope)FolderCallback()
-
Method Summary
Modifier and Type Method Description final CoroutineScopegetUiScope()final UnitsetUiScope(CoroutineScope uiScope)UnitonCountingFiles()LongonStart(DocumentFile folder, Integer totalFilesToCopy, Thread workerThread)UnitonParentConflict(DocumentFile destinationFolder, FolderCallback.ParentFolderConflictAction action, Boolean canMerge)Do not call superwhen you override this function.UnitonContentConflict(DocumentFile destinationFolder, List<FolderCallback.FileConflict> conflictedFiles, FolderCallback.FolderContentConflictAction action)-
Methods inherited from class com.anggrayudi.storage.callback.FolderCallback
onCheckFreeSpace, onCompleted, onDeleteConflictedFiles, onFailed, onPrepare, onReport, onValidate -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getUiScope
final CoroutineScope getUiScope()
-
setUiScope
final Unit setUiScope(CoroutineScope uiScope)
-
onCountingFiles
@UiThread() Unit onCountingFiles()
-
onStart
@UiThread() Long onStart(DocumentFile folder, Integer totalFilesToCopy, Thread workerThread)
- Parameters:
folder- directory to be copied/moved
-
onParentConflict
@UiThread() Unit onParentConflict(DocumentFile destinationFolder, FolderCallback.ParentFolderConflictAction action, Boolean canMerge)
Do not call
superwhen you override this function.The thread that does copy/move will be suspended until the user gives an answer via FileConflictAction.confirmResolution. You have to give an answer, or the thread will be alive until the app is killed and end up as a zombie thread. If you want to cancel, just pass ConflictResolution.SKIP into FileConflictAction.confirmResolution. If the worker thread is suspended for too long, it may be interrupted by the system.
- Parameters:
destinationFolder- when copying/storage/AAAA-BBBB/Movieto/storage/AAAA-BBBB/Others, it will be/storage/AAAA-BBBB/Others/MoviecanMerge- when conflict found, actionMERGEmay not exists.
-
onContentConflict
@UiThread() Unit onContentConflict(DocumentFile destinationFolder, List<FolderCallback.FileConflict> conflictedFiles, FolderCallback.FolderContentConflictAction action)
-
-
-
-