Skip to content

Commit 23114c3

Browse files
authored
Merge pull request #899 from Yalantis/fix/readme_file
Update README.md
2 parents eadab61 + 2c1920b commit 23114c3

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

README.md

+17-24
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
}
2525
```
2626

27-
``` implementation 'com.github.yalantis:ucrop:2.2.9' ``` - lightweight general solution
27+
``` implementation 'com.github.yalantis:ucrop:2.2.8' ``` - lightweight general solution
2828

29-
``` implementation 'com.github.yalantis:ucrop:2.2.9-native' ``` - get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
29+
``` implementation 'com.github.yalantis:ucrop:2.2.8-native' ``` - get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
3030

3131
2. Add UCropActivity into your AndroidManifest.xml
3232

@@ -37,28 +37,28 @@
3737
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
3838
```
3939
40-
3. Register a callback for the uCrop result.
41-
42-
```java
43-
private ActivityResultLauncher<Intent> activityResultLauncher =
44-
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
45-
if (result.getResultCode() == RESULT_OK) {
46-
final Uri resultUri = UCrop.getOutput(result.getData());
47-
} else if (result.getResultCode() == UCrop.RESULT_ERROR) {
48-
final Throwable cropError = UCrop.getError(result.getData());
49-
}
50-
});
51-
```
52-
53-
4. Create the uCrop configuration using the builder pattern.
40+
3. The uCrop configuration is created using the builder pattern.
5441
5542
```java
5643
UCrop.of(sourceUri, destinationUri)
5744
.withAspectRatio(16, 9)
5845
.withMaxResultSize(maxWidth, maxHeight)
59-
.start(context, activityResultLauncher);
46+
.start(context);
6047
```
6148

49+
4. Override `onActivityResult` method and handle uCrop result.
50+
51+
```java
52+
@Override
53+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
54+
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
55+
final Uri resultUri = UCrop.getOutput(data);
56+
} else if (resultCode == UCrop.RESULT_ERROR) {
57+
final Throwable cropError = UCrop.getError(data);
58+
}
59+
}
60+
```
61+
6262
5. You may want to add this to your PROGUARD config:
6363

6464
```
@@ -93,13 +93,6 @@ Currently, you can change:
9393

9494
# Changelog
9595

96-
### Version: 2.2.9
97-
98-
* Update compileSdk and targetSdk versions up to 33
99-
* Fixed [#867](https://github.com/Yalantis/uCrop/issues/867)
100-
* Fixed [#873](https://github.com/Yalantis/uCrop/issues/873)
101-
* And other improvements
102-
10396
### Version: 2.2.8
10497

10598
* Merged pending pull requests with improvements and bugfixes

0 commit comments

Comments
 (0)