Skip to content

Commit

Permalink
Merge pull request #19 from jens-muenker/develop-non-native
Browse files Browse the repository at this point in the history
4.0.1-non-native
  • Loading branch information
jens-muenker authored Sep 15, 2024
2 parents cff5b57 + b541d85 commit 137cb95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ If you have any ideas for uCrop'n'Edit, feel free to let me know. I will try my

# Changelog

**4.0.1-non-native**
- fixed a file size bug (https://github.com/Yalantis/uCrop/pull/926)

**4.0.0-non-native**
- replaced native libraries with Kotlin implementations
- added support for webp (and possibly other [Android-supported image formats](https://developer.android.com/media/platform/supported-formats#image-formats), but I have not tested it yet)
Expand Down
5 changes: 2 additions & 3 deletions ucrop/src/main/java/com/yalantis/ucrop/task/BitmapCropTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.renderscript.Element
import android.renderscript.RenderScript
import android.renderscript.ScriptIntrinsicConvolve3x3
import android.util.Log
import androidx.annotation.NonNull
import androidx.exifinterface.media.ExifInterface
import com.yalantis.ucrop.callback.BitmapCropCallback
import com.yalantis.ucrop.model.CropParameters
Expand Down Expand Up @@ -247,14 +246,14 @@ class BitmapCropTask(
}
}

private suspend fun saveImage(@NonNull croppedBitmap: Bitmap) = withContext(Dispatchers.IO) {
private suspend fun saveImage(croppedBitmap: Bitmap) = withContext(Dispatchers.IO) {
val context = contextRef.get() ?: return@withContext

var outputStream: OutputStream? = null
var outStream: ByteArrayOutputStream? = null

try {
outputStream = context.contentResolver.openOutputStream(mImageOutputUri)
outputStream = context.contentResolver.openOutputStream(mImageOutputUri, "wt")
outStream = ByteArrayOutputStream().also {
croppedBitmap.compress(mCompressFormat, mCompressQuality, it)
outputStream?.write(it.toByteArray())
Expand Down

0 comments on commit 137cb95

Please sign in to comment.