Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
anggrayudi committed Jan 24, 2022
1 parent 76fe812 commit 496f0e4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import com.anggrayudi.storage.file.CreateMode
import com.anggrayudi.storage.media.MediaFile
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope

/**
* Created on 17/08/20
* @author Anggrayudi H
*/
abstract class FileCallback @JvmOverloads constructor(
abstract class FileCallback @OptIn(DelicateCoroutinesApi::class) @JvmOverloads constructor(
uiScope: CoroutineScope = GlobalScope
) : BaseFileCallback<FileCallback.ErrorCode, FileCallback.Report, Any>(uiScope) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import com.anggrayudi.storage.callback.FileCallback.FileConflictAction
import com.anggrayudi.storage.file.CreateMode
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope

/**
* Created on 3/1/21
* @author Anggrayudi H
*/
abstract class FolderCallback @JvmOverloads constructor(
abstract class FolderCallback @OptIn(DelicateCoroutinesApi::class) @JvmOverloads constructor(
uiScope: CoroutineScope = GlobalScope
) : BaseFileCallback<FolderCallback.ErrorCode, FolderCallback.Report, FolderCallback.Result>(uiScope) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import com.anggrayudi.storage.callback.FileCallback.FileConflictAction
import com.anggrayudi.storage.callback.FolderCallback.ConflictResolution
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope

/**
* Created on 31/05/21
* @author Anggrayudi H
*/
abstract class MultipleFileCallback @JvmOverloads constructor(
abstract class MultipleFileCallback @OptIn(DelicateCoroutinesApi::class) @JvmOverloads constructor(
uiScope: CoroutineScope = GlobalScope
) : BaseFileCallback<MultipleFileCallback.ErrorCode, MultipleFileCallback.Report, MultipleFileCallback.Result>(uiScope) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import androidx.documentfile.provider.DocumentFile
import com.anggrayudi.storage.file.FileSize
import com.anggrayudi.storage.media.MediaFile
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope

/**
* Created on 02/01/22
* @author Anggrayudi H
*/
abstract class ZipCompressionCallback<T> @JvmOverloads constructor(var uiScope: CoroutineScope = GlobalScope) {
abstract class ZipCompressionCallback<T> @OptIn(DelicateCoroutinesApi::class)
@JvmOverloads constructor(var uiScope: CoroutineScope = GlobalScope) {

@UiThread
open fun onCountingFiles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import androidx.documentfile.provider.DocumentFile
import com.anggrayudi.storage.file.FileSize
import com.anggrayudi.storage.media.MediaFile
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope

/**
* Created on 02/01/22
* @author Anggrayudi H
*/
abstract class ZipDecompressionCallback<T> @JvmOverloads constructor(var uiScope: CoroutineScope = GlobalScope) {
abstract class ZipDecompressionCallback<T> @OptIn(DelicateCoroutinesApi::class)
@JvmOverloads constructor(var uiScope: CoroutineScope = GlobalScope) {

@UiThread
open fun onValidate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ private fun DocumentFile.walkFileTreeForSearch(
}

/**
* @param childrenOnly `true` to delete the folder contents only
* @see File.deleteRecursively
*/
@WorkerThread
Expand All @@ -897,6 +898,7 @@ fun DocumentFile.deleteRecursively(context: Context, childrenOnly: Boolean = fal
}

/**
* @param childrenOnly `true` to delete the folder contents only
* @return `true` if the file/folder was deleted or does not exist
* @see File.forceDelete
*/
Expand Down Expand Up @@ -962,6 +964,8 @@ fun DocumentFile.openFileIntent(context: Context, authority: String) = Intent(In

fun DocumentFile.hasParent(context: Context, parent: DocumentFile) = getAbsolutePath(context).hasParent(parent.getAbsolutePath(context))

fun DocumentFile.childOf(context: Context, parent: DocumentFile) = getAbsolutePath(context).childOf(parent.getAbsolutePath(context))

private fun DocumentFile.walkFileTree(context: Context): List<DocumentFile> {
val fileTree = mutableListOf<DocumentFile>()
listFiles().forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ private fun File.walkFileTreeAndDeleteEmptyFolders(): List<File> {
}

/**
* @param childrenOnly `true` to delete the folder contents only
* @see DocumentFile.deleteRecursively
*/
@JvmOverloads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.text.format.Formatter
import androidx.annotation.UiThread
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import java.util.*

Expand All @@ -27,6 +28,7 @@ data class FileProperties(

abstract class CalculationCallback(
val updateInterval: Long = 500, // 500ms
@OptIn(DelicateCoroutinesApi::class)
var uiScope: CoroutineScope = GlobalScope
) {

Expand Down

0 comments on commit 496f0e4

Please sign in to comment.