Skip to content

Commit 7eb3191

Browse files
authored
API: Deprecate CropImageContract. (#637)
1 parent 1f892e4 commit 7eb3191

4 files changed

Lines changed: 17 additions & 1 deletion

File tree

cropper/src/main/kotlin/com/canhub/cropper/CropImageContract.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package com.canhub.cropper
24

35
import android.app.Activity
@@ -11,8 +13,13 @@ import androidx.activity.result.contract.ActivityResultContract
1113
* The UI can be customized using [CropImageOptions].
1214
* If you do not provide an [CropImageContractOptions.uri] in the input the user will be asked to pick an image before cropping.
1315
*/
16+
@Deprecated(
17+
"""
18+
This ActivityResultContract is deprecated.
19+
Please either roll your own ActivityResultContract with the desired behavior or copy paste this.
20+
""",
21+
)
1422
class CropImageContract : ActivityResultContract<CropImageContractOptions, CropImageView.CropResult>() {
15-
@Suppress("DEPRECATION")
1623
override fun createIntent(context: Context, input: CropImageContractOptions) = Intent(context, CropImageActivity::class.java).apply {
1724
putExtra(
1825
CropImage.CROP_IMAGE_EXTRA_BUNDLE,

cropper/src/main/kotlin/com/canhub/cropper/CropImageContractOptions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ package com.canhub.cropper
22

33
import android.net.Uri
44

5+
@Deprecated(
6+
"""
7+
This ActivityResultContract is deprecated.
8+
Please either roll your own ActivityResultContract with the desired behavior or copy paste this.
9+
""",
10+
)
511
data class CropImageContractOptions(
612
val uri: Uri?,
713
val cropImageOptions: CropImageOptions,

cropper/src/test/kotlin/com/canhub/cropper/ContractTestFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package com.canhub.cropper
24

35
import android.content.Intent

cropper/src/test/kotlin/com/canhub/cropper/CropImageContractTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.junit.Assert.assertEquals
1717
import org.junit.Test
1818
import org.junit.runner.RunWith
1919

20+
@Suppress("DEPRECATION")
2021
@RunWith(AndroidJUnit4::class)
2122
class CropImageContractTest {
2223

0 commit comments

Comments
 (0)