Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Deprecate CropImageContract. #637

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading