check for null crop rect at editing an image

This commit is contained in:
tibbi 2017-01-10 18:34:22 +01:00
parent e3b85f6553
commit 9d300b7da8
12 changed files with 9 additions and 14 deletions

View File

@ -70,15 +70,21 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
} }
private fun resizeImage() { private fun resizeImage() {
ResizeDialog(this, getAreaSize()) { val point = getAreaSize()
if (point == null) {
toast(R.string.unknown_error)
return
}
ResizeDialog(this, point) {
resizeWidth = it.x resizeWidth = it.x
resizeHeight = it.y resizeHeight = it.y
crop_image_view.getCroppedImageAsync() crop_image_view.getCroppedImageAsync()
} }
} }
private fun getAreaSize(): Point { private fun getAreaSize(): Point? {
val rect = crop_image_view.cropRect val rect = crop_image_view.cropRect ?: return null
val rotation = crop_image_view.rotatedDegrees val rotation = crop_image_view.rotatedDegrees
return if (rotation == 0 || rotation == 180) { return if (rotation == 0 || rotation == 180) {
Point(rect.width(), rect.height()) Point(rect.width(), rect.height())

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Ohne Zugriff auf deinen Speicher gibt es hier nicht viel zu tun</string> <string name="no_permissions">Ohne Zugriff auf deinen Speicher gibt es hier nicht viel zu tun</string>
<string name="edit">Bearbeiten</string> <string name="edit">Bearbeiten</string>
<string name="open_camera">Kamera öffnen</string> <string name="open_camera">Kamera öffnen</string>
<string name="unknown_error">Ein unbekannter Fehler ist aufgetreten</string>
<string name="open_with">Öffnen mit</string> <string name="open_with">Öffnen mit</string>
<string name="no_app_found">Keine zulässige App gefunden</string> <string name="no_app_found">Keine zulässige App gefunden</string>
<string name="hide_folder">Ordner verstecken</string> <string name="hide_folder">Ordner verstecken</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">No hay mucho que hacer en una galería sin acceso al almacenamiento</string> <string name="no_permissions">No hay mucho que hacer en una galería sin acceso al almacenamiento</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="open_camera">Abrir cámara</string> <string name="open_camera">Abrir cámara</string>
<string name="unknown_error">Ocurrió un error desconocido</string>
<string name="open_with">Abrir con&#8230;</string> <string name="open_with">Abrir con&#8230;</string>
<string name="no_app_found">No valid app found</string> <string name="no_app_found">No valid app found</string>
<string name="hide_folder">Ocultar carpeta</string> <string name="hide_folder">Ocultar carpeta</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Peu de choses à faire dans l\'album sans accès à la mémoire</string> <string name="no_permissions">Peu de choses à faire dans l\'album sans accès à la mémoire</string>
<string name="edit">Édition</string> <string name="edit">Édition</string>
<string name="open_camera">Ouvrir caméra</string> <string name="open_camera">Ouvrir caméra</string>
<string name="unknown_error">Une erreur inconnue est survenue.</string>
<string name="open_with">Ouvrir avec</string> <string name="open_with">Ouvrir avec</string>
<string name="no_app_found">Aucune application valide trouvée</string> <string name="no_app_found">Aucune application valide trouvée</string>
<string name="hide_folder">Cacher le dossier</string> <string name="hide_folder">Cacher le dossier</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Non c\'è molto da fare in una galleria senza l\'accesso all\'archiviazione</string> <string name="no_permissions">Non c\'è molto da fare in una galleria senza l\'accesso all\'archiviazione</string>
<string name="edit">Modifica</string> <string name="edit">Modifica</string>
<string name="open_camera">Apri fotocamera</string> <string name="open_camera">Apri fotocamera</string>
<string name="unknown_error">Riscontrato un errore sconosciuto</string>
<string name="open_with">Apri con</string> <string name="open_with">Apri con</string>
<string name="no_app_found">Nessun app valida trovata</string> <string name="no_app_found">Nessun app valida trovata</string>
<string name="hide_folder">Nascondi cartella</string> <string name="hide_folder">Nascondi cartella</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">ストレージにアクセスしないとギャラリーでできることはほとんどありません</string> <string name="no_permissions">ストレージにアクセスしないとギャラリーでできることはほとんどありません</string>
<string name="edit">編集</string> <string name="edit">編集</string>
<string name="open_camera">カメラを開く</string> <string name="open_camera">カメラを開く</string>
<string name="unknown_error">不明なエラーが発生しました</string>
<string name="open_with">&#8230;で開く</string> <string name="open_with">&#8230;で開く</string>
<string name="no_app_found">有効なアプリが見つかりません</string> <string name="no_app_found">有効なアプリが見つかりません</string>
<string name="hide_folder">フォルダーを非表示</string> <string name="hide_folder">フォルダーを非表示</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">É necessário o acesso ao armazenamento para a galeria ter utilidade</string> <string name="no_permissions">É necessário o acesso ao armazenamento para a galeria ter utilidade</string>
<string name="edit">Editar</string> <string name="edit">Editar</string>
<string name="open_camera">Abrir câmara</string> <string name="open_camera">Abrir câmara</string>
<string name="unknown_error">Ocorreu um erro desconhecido</string>
<string name="open_with">Abrir com</string> <string name="open_with">Abrir com</string>
<string name="no_app_found">Nenhuma aplicação encontrada</string> <string name="no_app_found">Nenhuma aplicação encontrada</string>
<string name="hide_folder">Ocultar pasta</string> <string name="hide_folder">Ocultar pasta</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Не предоставлено разрешение для доступа к файловой системе</string> <string name="no_permissions">Не предоставлено разрешение для доступа к файловой системе</string>
<string name="edit">Редактировать</string> <string name="edit">Редактировать</string>
<string name="open_camera">Открыть камеру</string> <string name="open_camera">Открыть камеру</string>
<string name="unknown_error">Произошла неизвестная ошибка</string>
<string name="open_with">Открыть в</string> <string name="open_with">Открыть в</string>
<string name="no_app_found">Приложение не найдено</string> <string name="no_app_found">Приложение не найдено</string>
<string name="hide_folder">Скрыть папку</string> <string name="hide_folder">Скрыть папку</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Inte mycket att göra i ett galleri om jag inte kommer åt lagringsutrymmet</string> <string name="no_permissions">Inte mycket att göra i ett galleri om jag inte kommer åt lagringsutrymmet</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="open_camera">Starta kameran</string> <string name="open_camera">Starta kameran</string>
<string name="unknown_error">Ett okänt fel har uppstått</string>
<string name="open_with">Open with</string> <string name="open_with">Open with</string>
<string name="no_app_found">No valid app found</string> <string name="no_app_found">No valid app found</string>
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">需要访问储存权限</string> <string name="no_permissions">需要访问储存权限</string>
<string name="edit">编辑</string> <string name="edit">编辑</string>
<string name="open_camera">打开相机</string> <string name="open_camera">打开相机</string>
<string name="unknown_error">未知错误</string>
<string name="open_with">打开方式</string> <string name="open_with">打开方式</string>
<string name="no_app_found">没有可用的应用</string> <string name="no_app_found">没有可用的应用</string>
<string name="hide_folder">隐藏文件夹</string> <string name="hide_folder">隐藏文件夹</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">一個沒有權限存取您的儲存空間的藝廊能做的事情寥寥無幾</string> <string name="no_permissions">一個沒有權限存取您的儲存空間的藝廊能做的事情寥寥無幾</string>
<string name="edit">編輯</string> <string name="edit">編輯</string>
<string name="open_camera">開啟相機</string> <string name="open_camera">開啟相機</string>
<string name="unknown_error">未知錯誤</string>
<string name="open_with">以其他應用軟體開啟</string> <string name="open_with">以其他應用軟體開啟</string>
<string name="no_app_found">沒有可用的應用軟體</string> <string name="no_app_found">沒有可用的應用軟體</string>
<string name="hide_folder">隱藏資料夾</string> <string name="hide_folder">隱藏資料夾</string>

View File

@ -6,7 +6,6 @@
<string name="no_permissions">Not much to do in a gallery without accessing your storage</string> <string name="no_permissions">Not much to do in a gallery without accessing your storage</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="open_camera">Open camera</string> <string name="open_camera">Open camera</string>
<string name="unknown_error">An unknown error occurred</string>
<string name="open_with">Open with</string> <string name="open_with">Open with</string>
<string name="no_app_found">No valid app found</string> <string name="no_app_found">No valid app found</string>
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>