@@ -63,15 +63,15 @@ Where `$libVersion` = [, (ActivityResult result) - > {
68
- if (result. getResultCode() == RESULT_OK ) {
69
- Uri uri = result. getData(). getData();
70
- // Use the uri to load the image
71
- } else if (result. getResultCode() == ImagePicker . RESULT_ERROR ) {
72
- // Use ImagePicker.Companion.getError(result.getData()) to show an error
73
- }
74
- });
66
+ ActivityResultLauncher<Intent > launcher=
67
+ registerForActivityResult(new ActivityResultContracts .StartActivityForResult (),(ActivityResult result)- > {
68
+ if (result. getResultCode()== RESULT_OK ){
69
+ Uri uri= result. getData(). getData();
70
+ // Use the uri to load the image
71
+ } else if (result. getResultCode()== ImagePicker . RESULT_ERROR ){
72
+ // Use ImagePicker.Companion.getError(result.getData()) to show an error
73
+ }
74
+ });
75
75
```
76
76
77
77
** If you want both Camera and Gallery:**
@@ -88,22 +88,22 @@ Where `$libVersion` = [
92
- .crop()
93
- .cropOval()
91
+ ImagePicker . Companion . with(this )
92
+ .crop()
93
+ .cropOval()
94
94
.maxResultSize(512 ,512 ,true )
95
95
.provider(ImageProvider . BOTH ) // Or bothCameraGallery()
96
96
.createIntentFromDialog((Function1 )(new Function1 (){
97
- public Object invoke (Object var1 ) {
98
- this . invoke((Intent ) var1);
99
- return Unit . INSTANCE ;
100
- }
101
-
102
- public final void invoke (@NotNull Intent it ) {
103
- Intrinsics . checkNotNullParameter(it, " it" );
104
- launcher. launch(it);
105
- }
106
- }));
97
+ public Object invoke (Object var1 ){
98
+ this . invoke((Intent )var1);
99
+ return Unit . INSTANCE ;
100
+ }
101
+
102
+ public final void invoke (@NotNull Intent it ){
103
+ Intrinsics . checkNotNullParameter(it," it" );
104
+ launcher. launch(it);
105
+ }
106
+ }));
107
107
```
108
108
109
109
** If you want just one option:**
@@ -122,7 +122,7 @@ Where `$libVersion` = [
125
+ ImagePicker . Companion . with(this )
126
126
.crop() // Crop image(Optional), Check Customization for more option
127
127
.cropOval() // Allow dimmed layer to have a circle inside
128
128
.cropFreeStyle() // Let the user to resize crop bounds
0 commit comments