flip width and height if the image is rotated
This commit is contained in:
parent
900dbbff32
commit
e99451b2f0
1 changed files with 11 additions and 3 deletions
|
@ -76,13 +76,21 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
private fun resizeImage() {
|
||||
val rect = crop_image_view.cropRect
|
||||
val croppedSize = Point(rect.width(), rect.height())
|
||||
ResizeDialog(this, croppedSize) {
|
||||
ResizeDialog(this, getAreaSize()) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAreaSize(): Point {
|
||||
val rect = crop_image_view.cropRect
|
||||
val rotation = crop_image_view.rotatedDegrees
|
||||
return if (rotation == 0 || rotation == 180) {
|
||||
Point(rect.width(), rect.height())
|
||||
} else {
|
||||
Point(rect.height(), rect.width())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) {
|
||||
if (result.error == null) {
|
||||
if (uri.scheme == "file") {
|
||||
|
|
Loading…
Reference in a new issue