Upgraded to 4.5.0 (we can't use 4.6.0 yet due to kotlin 2.0 usage)

This commit is contained in:
ThomasSession 2024-08-09 12:51:29 +10:00
parent fea17d77a1
commit 2aeb769815
2 changed files with 24 additions and 15 deletions

View File

@ -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'

View File

@ -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
)
)
)
}