flip width and height if the image is rotated

This commit is contained in:
tibbi 2016-12-06 20:55:11 +01:00
parent 900dbbff32
commit e99451b2f0

View file

@ -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") {