Skip to content

Commit

Permalink
API: Deprecate CropImageContract. (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech authored Aug 5, 2024
1 parent 1f892e4 commit 7eb3191
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package com.canhub.cropper

import android.app.Activity
Expand All @@ -11,8 +13,13 @@ import androidx.activity.result.contract.ActivityResultContract
* The UI can be customized using [CropImageOptions].
* If you do not provide an [CropImageContractOptions.uri] in the input the user will be asked to pick an image before cropping.
*/
@Deprecated(
"""
This ActivityResultContract is deprecated.
Please either roll your own ActivityResultContract with the desired behavior or copy paste this.
""",
)
class CropImageContract : ActivityResultContract<CropImageContractOptions, CropImageView.CropResult>() {
@Suppress("DEPRECATION")
override fun createIntent(context: Context, input: CropImageContractOptions) = Intent(context, CropImageActivity::class.java).apply {
putExtra(
CropImage.CROP_IMAGE_EXTRA_BUNDLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package com.canhub.cropper

import android.net.Uri

@Deprecated(
"""
This ActivityResultContract is deprecated.
Please either roll your own ActivityResultContract with the desired behavior or copy paste this.
""",
)
data class CropImageContractOptions(
val uri: Uri?,
val cropImageOptions: CropImageOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package com.canhub.cropper

import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

@Suppress("DEPRECATION")
@RunWith(AndroidJUnit4::class)
class CropImageContractTest {

Expand Down

0 comments on commit 7eb3191

Please sign in to comment.