💾 Simplify Android Storage Access Framework for file management across API levels.
Fixes
Features
Features
DocumentFile.findParent()
to overcome DocumentFile.parentFile
drawbacks.DocumentFile.childOf()
List<MediaFile>.compressToZip()
MediaFile.decompressZip()
Breaking Changes
ZipCompressionCallback
and ZipDecompressionCallback
now requires generic data type, i.e. DocumentFile
or MediaFile
DocumentFile
. See storage/consumer-rules.pro
Fixes
Features
List<DocumentFile>.compressToZip()
DocumentFile.decompressZip()
MediaStoreCompat.deleteEmptyMediaFiles()
MediaFile.presentsInSafDatabase
MediaFile.hasZeroLength
MediaFile.presentsInSafDatabase
Breaking Changes
closeStream()
to closeStreamQuietly()
(issue #60)FileDescription.mimeType
now returns appropriate mime type. Using image/*
or */*
will return application/octet-stream
MediaFile.exists
MediaFile.isEmpty
now returns true if the file does not exists or has zero length.MediaFile.renameTo()
now throws UnsupportedOperationException
on Android 10+.Fixes
MimeType.hasExtension()
Features
Fixes
Features
SimpleStorageHelper.requestStorageAccess(expectedBasePath)
on API 30+MediaStoreCompat.createMedia()
Breaking Changes
Fixes
Features
SimpleStorage.checkIfFileReceived()
in onCreate()
and onNewIntent()
, then FileReceiverCallback
will be triggered if any files received via Intent.ACTION_SEND
or Intent.ACTION_SEND_MULTIPLE
.SimpleStorageHelper
.Fixes
Features
DocumentFile.getFormattedSize()
and MediaFile.formattedSize
Breaking Changes
requiresWriteAccess
to:
DocumentFileCompat.fromSimplePath()
DocumentFileCompat.fromFullPath()
DocumentFileCompat.fromFile()
Fixes
RawDocumentFile
for DocumentFileCompat.from*()
. Fixed by adding requiresWriteAccess
.DocumentFile.toTreeDocumentFile()
doesn't return null for SingleDocumentFile
Features
ComponentActivity
(#28).Intent.ACTION_CREATE_DOCUMENT
DocumentFile.child()
is 36% faster now. It affects the entire library performance, for example mkdirs()
, makeFolder()
, etc. See this benchmark.Breaking Changes
SimpleStorageHelper
and your activities are direct subclass of android.app.Activity
, then you need to call onRequestPermissionsResult()
. I recommend using ComponentActivity
or AppCompatActivity
so you don't need to call onRequestPermissionsResult()
.DocumentFile.doesExist()
. Use DocumentFile.child() != null
instead.Fixes
DocumentFileCompat.getRootDocumentFile()
doesn't return null
when the URI permission hasn't been granted yet.