Skip to content

Commit f433048

Browse files
committed
ReadME file updated
1 parent 2addf80 commit f433048

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ I have added other pickers as well(pdf,doc,video,pictures).
88

99
I have tested with multiple scenarios , here is the scenario list
1010

11-
1. Android 8 to 13 versions
11+
1. Android 8 to 16 versions
1212
2. Also Add the Single Photo and Multiple Photo Selection
1313
3. Single Photo Selection Working on All Android Versions
14-
4. Multiple Photo Selection will work from Android 11 to Android 13.
14+
4. Multiple Photo Selection will work from Android 11 to Android 16.
1515
5. Multiple Photo Selection below Android 11 we have to use clipdata the old way.
1616

1717
Here how to use library in your project follow below steps .
@@ -22,7 +22,7 @@ Here how to use library in your project follow below steps .
2222
implementation 'com.github.ParthLotia:FilePicker:Tag'
2323
}
2424
```
25-
Replace your Tag with current version 1.0.8
25+
Replace your Tag with current version 1.0.9
2626

2727
2. In your project level gradle add below line
2828
```
@@ -69,6 +69,33 @@ Replace your Tag with current version 1.0.8
6969
}
7070
}
7171
72+
For Jetpack Compose
73+
74+
Button(onClick = {
75+
singleFilePickerLauncher.launch(arrayOf("*/*"))
76+
}) {
77+
Text(text = "Choose File")
78+
}
79+
80+
val singleFilePickerLauncher = rememberLauncherForActivityResult(
81+
contract = ActivityResultContracts.OpenDocument(),
82+
onResult = { uri ->
83+
84+
if (uri != null) {
85+
file = FileUriUtils.getRealPath(this, uri)?.let { File(it) }
86+
if (FileUriUtils.checkExtensionFile(file)) {
87+
selectedSingleImageUri.value = uri
88+
selectedSingleImageUriThumbnail.value = null
89+
} else {
90+
selectedSingleImageUri.value = null
91+
Log.e("uri", "PLAndroid" + uri)
92+
selectedSingleImageUriThumbnail.value = uri
93+
94+
}
95+
}
96+
}
97+
)
98+
7299
Here img_pick is an Imageview to display the file you have selected .
73100
```
74101

app/src/main/java/com/android/parth/FilePickerActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class FilePickerActivity : ComponentActivity() {
9595
selectedSingleImageUriThumbnail.value = null
9696
} else {
9797
selectedSingleImageUri.value = null
98-
Log.e("uri", "123123" + uri)
98+
Log.e("uri", "PLAndroid" + uri)
9999
selectedSingleImageUriThumbnail.value = uri
100100

101101
}

0 commit comments

Comments
 (0)