Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed.atwa committed Mar 5, 2023
1 parent 92f0737 commit 04e7c85
Showing 1 changed file with 56 additions and 27 deletions.
83 changes: 56 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
Android library to facilitate files and image picking up process whether from storage or camera and ability to convert them to request
bodies without permission.

**The goal of this app is to get rid of the hassle of file picking up handling and reduce effort
**The goal of this library is to get rid of the hassle of file picking up handling and reduce effort
made in uploading them to server without the need to ask use for a single permission.**

## Features:

-Launch different file types picking intents/requests (Image, Pdf and File for general). -Get a
callback with bitmap in case of image alongside with file object. -Get a callback with a fileName in
case of Pdf & File alongside with file object. -Convert picked up files to request bodies to use
them with api requests to upload them to server, -Not a single permission is required.
- Launch different file types picking requests (Image ,Video ,Pdf and File for general).
- Get a callback with related meta according to the request type.
- Meta can be (fileName,size in Kb, bitmap and file object).
- Convert picked up files to request bodies to use them with api requests to upload them to server.
- Not a single permission is required.

## Dependency :

Expand All @@ -26,49 +27,76 @@ them with api requests to upload them to server, -Not a single permission is req

```
dependencies {
implementation 'com.github.atwa:filepicker:1.0.4'
implementation 'com.github.atwa:filepicker:1.0.5'
}
```

## Usage :
- Initialize instance in activity whether as member variable or in onCreate()
- Initialize instance in activity/fragment as member variable.
```
private val filePicker = FilePicker.getInstance(this)
```

- Image picking
```
fun pickImage() {
filePicker.pickImage() { result ->
val bitmap : Bitmap? = result?.first
val file : File? = result?.second
filePicker.pickImage() { meta ->
val name : String? = meta?.name
val sizeKb : Int? = meta?.sizeKb
val file : File? = meta?.file
val bitmap : Bitmap? = meta?.bitmap
}
}
```
- Image capture
```
fun captureImage() {
filePicker.captureCameraImage() { meta ->
val name : String? = meta?.name
val sizeKb : Int? = meta?.sizeKb
val file : File? = meta?.file
val bitmap : Bitmap? = meta?.bitmap
}
}
```
- Pdf picking
```
fun pickPdf() {
filePicker.pickPdf() { result ->
val name: String? = result?.first
val file: File? = result?.second
filePicker.pickPdf() { meta ->
val name: String? = meta?.name
val sizeKb: Int? = meta?.sizeKb
val file: File? = meta?.file
}
}
```
- Video picking
```
fun pickVideo() {
filePicker.pickVideo() { meta ->
val name: String? = meta?.name
val sizeKb: Int? = meta?.sizeKb
val file: File? = meta?.file
val thumbnail: Bitmap? = meta?.thumbnail
}
}
```
- File picking
```
fun pickFile() {
filePicker.pickFile() { result ->
val name : String? = result?.first
val file : File? = result?.second
filePicker.pickFile() { meta ->
val name: String? = meta?.name
val sizeKb: Int? = meta?.sizeKb
val file: File? = meta?.file
}
}
```
- Image capture
- File picking from Initial directory
```
fun captureImage() {
filePicker.captureCameraImage() { result ->
val bitmap : Bitmap? = result?.first
val file : File? = result?.second
fun pickFile() {
filePicker.pickFile("path") { meta ->
val name: String? = meta?.name
val sizeKb: Int? = meta?.sizeKb
val file: File? = meta?.file
}
}
```
Expand All @@ -82,12 +110,13 @@ them with api requests to upload them to server, -Not a single permission is req
```

### Version history
| Version | Release note |
| ------ | ------------- |
| 1.0.0 | Initial release |
| 1.0.1 | Increase buffer size to handle larger files (8GB Max) |
| 1.0.3 | Fix bug : LifecycleOwner Activity is attempting to register while current state is RESUMED. |
| 1.0.4 | Enhancement : Avoid possible activity reference leaking <br /> Feature : Implement camera image picker. |
| Version | Release note |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| 1.0.0 | Initial release. |
| 1.0.1 | Increase buffer size (8GB) to be larger for better performance. |
| 1.0.3 | Fix bug : LifecycleOwner Activity is attempting to register while current state is RESUMED. |
| 1.0.4 | Enhancement : Avoid possible activity reference leaking. <br /> Feature : Implement camera image picker. |
| 1.0.5 | Feature : Support fragments. <br /> Feature : Implement file picking from initial directory. <br /> fix : obsolete app icon unintended overriding. |



Expand Down

0 comments on commit 04e7c85

Please sign in to comment.