Skip to content

Commit b4fbd60

Browse files
author
LaksCastro
committed
(#46) Add mising docs to all new APIs
1 parent 2a16b18 commit b4fbd60

7 files changed

Lines changed: 597 additions & 185 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,21 @@ See the label [reference here](/docs/Usage/API%20Labeling.md).
4040

4141
- <samp>Mirror</samp> `buildDocumentUri` from [`DocumentsContract.buildDocumentUri`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildDocumentUri(java.lang.String,%20java.lang.String)>).
4242

43-
- <samp>Mirror</samp> `buildDocumentUri` from [`DocumentsContract.buildDocumentUri`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildDocumentUri(java.lang.String,%20java.lang.String)>).
44-
4543
- <samp>Mirror</samp> `buildTreeDocumentUri` from [`DocumentsContract.buildTreeDocumentUri`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildTreeDocumentUri(java.lang.String,%20java.lang.String)>).
4644

47-
- <samp>Mirror</samp> `createFile` from [`DocumentFile.createFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createFile(java.lang.String,%20java.lang.String)>). Create a child file from given a parent uri.
48-
4945
- <samp>Mirror</samp> `delete` from [`DocumentFile.delete`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#delete()>). Self explanatory.
5046

5147
- <samp>Mirror</samp> `createDirectory` from [`DocumentFile.createDirectory`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createDirectory(java.lang.String)>). Creates a new child document file that represents a directory given the `displayName` (folder name).
5248

53-
- <samp>Mirror</samp> `createFile` from [`DocumentFile.createFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createFile(java.lang.String,%20java.lang.String)>). Creates a new child document file that represents a single file given the `displayName` and the `mimeType` (file name and file type, respectively).
49+
- <samp>Alias</samp> `createFile`. Alias for `createFileAsBytes` or `createFileAsString` depending which params are provided.
5450

55-
- <samp>Alias</samp> `createFileAsBytes`. Alias for `createFile(bytes: Uint8List.fromList('file content...'.codeUnits))`.
51+
- <samp>Mirror</samp> `createFileAsBytes` from [`DocumentFile.createFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createFile(java.lang.String,%20java.lang.String)>). Given the parent uri, creates a new child document file that represents a single file given the `displayName`, `mimeType` and its `content` in bytes (file name, file type and file content in raw bytes, respectively).
5652

57-
- <samp>Alias</samp> `createFileAsString`. Alias for `createFile(content: 'file content...')`.
53+
- <samp>Alias</samp> `createFileAsString`. Alias for `createFileAsBytes(bytes: Uint8List.fromList('file content...'.codeUnits))`.
5854

59-
- <samp>Mirror</samp> `documentLength` from [`DocumentFile.length`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#length()>). Returns the length of this file in bytes. Returns 0 if the file does not exist, or if the length is unknown.
55+
- <samp>Mirror</samp> `documentLength` from [`DocumentFile.length`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#length()>). Returns the length of the given file (uri) in bytes. Returns 0 if the file does not exist, or if the length is unknown.
6056

61-
- <samp>Mirror</samp> `lastModified` from [`DocumentFile.lastModified`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#lastModified()>). Returns the time when this file was last modified, measured in milliseconds since January 1st, 1970, midnight. Returns 0 if the file does not exist, or if the modified time is unknown.
57+
- <samp>Mirror</samp> `lastModified` from [`DocumentFile.lastModified`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#lastModified()>). Returns the time when the given file (uri) was last modified, measured in milliseconds since January 1st, 1970, midnight. Returns 0 if the file does not exist, or if the modified time is unknown.
6258

6359
- <samp>Mirror</samp> `findFile` from [`DocumentFile.findFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#findFile(java.lang.String)>). Search through listFiles() for the first document matching the given display name, this method has a really poor performance for large data sets, prefer using `child` instead.
6460

@@ -72,8 +68,6 @@ See the label [reference here](/docs/Usage/API%20Labeling.md).
7268

7369
- <samp>Original</samp> `getDocumentContent`. Read a document file from its uri by opening a input stream and returning its bytes.
7470

75-
- <samp>Alias</samp> `getDocumentContentAsString`. Alias for `getDocumentContent` except this convert the bytes to `String`.
76-
7771
- <samp>External</samp> `child` from [`com.anggrayudi.storage.file.DocumentFile.child`](https://github.com/anggrayudi/SimpleStorage/blob/551fae55641dc58a9d3d99cb58fdf51c3d312b2d/storage/src/main/java/com/anggrayudi/storage/file/DocumentFileExt.kt#L270). Find the child file of a given parent uri and child name, null if doesn't exists (faster than `findFile`).
7872

7973
- <samp>Original `UNSTABLE`</samp> `openDocumentFile`. Open a file uri in a external app, by starting a new activity with `ACTION_VIEW` Intent.
@@ -87,8 +81,7 @@ See the label [reference here](/docs/Usage/API%20Labeling.md).
8781
- <samp>Extension</samp> `UriDocumentFileUtils` on `Uri` (Accesible by `uri.extensionMethod(...)`).
8882

8983
- <samp>Alias</samp> `toDocumentFile`. Alias for `DocumentFile.fromTreeUri(this)` which is an alias for `fromTreeUri`. method: convert `this` to the respective `DocumentFile` (if exists, otherwise `null`).
90-
- <samp>Alias</samp> `open`. Alias for `openDocumentFile`.
91-
- <samp>Alias</samp> `openDocumentFile`. Alias for `openDocumentFile` (same of `open` alias with a more specific name).
84+
- <samp>Alias</samp> `openDocumentFile`. Alias for `openDocumentFile`.
9285

9386
- <samp>Mirror</samp> `getDownloadCacheDirectory` from [`Environment.getDataDirectory`](https://developer.android.com/reference/android/os/Environment#getDownloadCacheDirectory%28%29).
9487

docs/Usage/API Labeling.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ This package is intended to be a mirror of native Android APIs. Which means all
88

99
You are fully encouraged to understand/learn the native Android APIs to use this package. All packages (not only this one) are derivated from native APIs depending on the platform (Windows, iOS, Android, Unix, Web, etc.), to have a understing about it can help not only here but on all your Flutter journey, and even in other frameworks.
1010

11-
| **Label** | Description |
12-
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
13-
| **Internal** | New internal type (class). Usually they are only to keep a safe typing and are not usually intended to be instantiated for the package user. |
14-
| **Original** | Original API which only exists inside this package and doesn't mirror any Android API (an abstraction). |
15-
| **Mirror** | Pure mirror API (method/class) which was re-implemented in Dart from a native original API. |
16-
| **External** | API from third-part Android libraries. |
11+
| **Label** | Description |
12+
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
13+
| **Internal** | New internal type (class). Usually they are only to keep a safe typing and are not usually intended to be instantiated for the package user. |
14+
| **Original** | Original API which only exists inside this package and doesn't mirror any Android API (an abstraction). |
15+
| **Mirror** | Pure mirror API (method/class) which was re-implemented in Dart from a native original API. |
16+
| **Alias** | Convenient methods. They do not implement anything new but create a new abstraction from an existing API. |
17+
| **External** | API from third-part Android libraries. |
18+
| **Extension** | These are most alias methods implemented through Dart extensions. |

0 commit comments

Comments
 (0)