diff --git a/app/build.gradle b/app/build.gradle index 4da9ed5ebe..f72856553d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -284,7 +284,7 @@ dependencies { implementation 'com.pnikosis:materialish-progress:1.5' implementation 'org.greenrobot:eventbus:3.0.0' implementation 'pl.tajchert:waitingdots:0.1.0' - implementation 'com.vanniktech:android-image-cropper:4.3.3' + implementation 'com.vanniktech:android-image-cropper:4.5.0' implementation 'com.melnykov:floatingactionbutton:1.3.0' implementation 'com.google.zxing:android-integration:3.1.0' implementation 'mobi.upod:time-duration-picker:1.1.3' diff --git a/app/src/main/java/org/thoughtcrime/securesms/avatar/AvatarSelection.kt b/app/src/main/java/org/thoughtcrime/securesms/avatar/AvatarSelection.kt index 961700089a..adf4b0927c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/avatar/AvatarSelection.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/avatar/AvatarSelection.kt @@ -10,8 +10,8 @@ import android.provider.MediaStore import androidx.activity.result.ActivityResultLauncher import androidx.core.content.ContextCompat import com.canhub.cropper.CropImageContractOptions +import com.canhub.cropper.CropImageOptions import com.canhub.cropper.CropImageView -import com.canhub.cropper.options import network.loki.messenger.R import org.session.libsession.utilities.getColorFromAttr import org.session.libsignal.utilities.ExternalStorageUtil.getImageDir @@ -43,19 +43,28 @@ class AvatarSelection( outputFile: Uri? ) { onAvatarCropped.launch( - options(inputFile) { - setGuidelines(CropImageView.Guidelines.ON) - setAspectRatio(1, 1) - setCropShape(CropImageView.CropShape.OVAL) - setOutputUri(outputFile) - setAllowRotation(true) - setAllowFlipping(true) - setBackgroundColor(imageScrim) - setToolbarColor(bgColor) - setActivityBackgroundColor(bgColor) - setToolbarTintColor(txtColor) - setActivityTitle(activityTitle) - } + CropImageContractOptions( + uri = inputFile, + cropImageOptions = CropImageOptions( + guidelines = CropImageView.Guidelines.ON, + aspectRatioX = 1, + aspectRatioY = 1, + fixAspectRatio = true, + cropShape = CropImageView.CropShape.OVAL, + customOutputUri = outputFile, + allowRotation = true, + allowFlipping = true, + backgroundColor = imageScrim, + toolbarColor = bgColor, + activityBackgroundColor = bgColor, + toolbarTintColor = txtColor, + toolbarBackButtonColor = txtColor, + toolbarTitleColor = txtColor, + activityMenuIconColor = txtColor, + activityMenuTextColor = txtColor, + activityTitle = activityTitle + ) + ) ) }