@@ -8,10 +8,10 @@ I have added other pickers as well(pdf,doc,video,pictures).
88
99I 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
12122 . Also Add the Single Photo and Multiple Photo Selection
13133 . 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 .
15155 . Multiple Photo Selection below Android 11 we have to use clipdata the old way.
1616
1717Here 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
27272 . 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
0 commit comments