From 9d300b7da8ed3d6613e9ba692fa28d41c9f40ed1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 10 Jan 2017 18:34:22 +0100 Subject: [PATCH] check for null crop rect at editing an image --- .../gallery/activities/EditActivity.kt | 12 +++++++++--- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-pt-rPT/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 12 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 797236491..88b5b1fde 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -70,15 +70,21 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } private fun resizeImage() { - ResizeDialog(this, getAreaSize()) { + val point = getAreaSize() + if (point == null) { + toast(R.string.unknown_error) + return + } + + ResizeDialog(this, point) { resizeWidth = it.x resizeHeight = it.y crop_image_view.getCroppedImageAsync() } } - private fun getAreaSize(): Point { - val rect = crop_image_view.cropRect + private fun getAreaSize(): Point? { + val rect = crop_image_view.cropRect ?: return null val rotation = crop_image_view.rotatedDegrees return if (rotation == 0 || rotation == 180) { Point(rect.width(), rect.height()) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4e7256813..c41e6d012 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -6,7 +6,6 @@ Ohne Zugriff auf deinen Speicher gibt es hier nicht viel zu tun Bearbeiten Kamera öffnen - Ein unbekannter Fehler ist aufgetreten Öffnen mit Keine zulässige App gefunden Ordner verstecken diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 93eb5106a..40460411c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -6,7 +6,6 @@ No hay mucho que hacer en una galería sin acceso al almacenamiento Edit Abrir cámara - Ocurrió un error desconocido Abrir con… No valid app found Ocultar carpeta diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 20b88a667..af0cad6f0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -6,7 +6,6 @@ Peu de choses à faire dans l\'album sans accès à la mémoire Édition Ouvrir caméra - Une erreur inconnue est survenue. Ouvrir avec Aucune application valide trouvée Cacher le dossier diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 45d29b01f..a817de101 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -6,7 +6,6 @@ Non c\'è molto da fare in una galleria senza l\'accesso all\'archiviazione Modifica Apri fotocamera - Riscontrato un errore sconosciuto Apri con Nessun app valida trovata Nascondi cartella diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 2cfeeab5b..5314d45d4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -6,7 +6,6 @@ ストレージにアクセスしないとギャラリーでできることはほとんどありません 編集 カメラを開く - 不明なエラーが発生しました …で開く 有効なアプリが見つかりません フォルダーを非表示 diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index ee98b3d25..c86fbbdc8 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -6,7 +6,6 @@ É necessário o acesso ao armazenamento para a galeria ter utilidade Editar Abrir câmara - Ocorreu um erro desconhecido Abrir com Nenhuma aplicação encontrada Ocultar pasta diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f2bdaa88b..ede8740aa 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -6,7 +6,6 @@ Не предоставлено разрешение для доступа к файловой системе Редактировать Открыть камеру - Произошла неизвестная ошибка Открыть в Приложение не найдено Скрыть папку diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index fc2825749..d5f816579 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -6,7 +6,6 @@ Inte mycket att göra i ett galleri om jag inte kommer åt lagringsutrymmet Edit Starta kameran - Ett okänt fel har uppstått Open with No valid app found Hide folder diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 90adf3231..b50acbc55 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -6,7 +6,6 @@ 需要访问储存权限 编辑 打开相机 - 未知错误 打开方式 没有可用的应用 隐藏文件夹 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d311962be..10a49a9fa 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -6,7 +6,6 @@ 一個沒有權限存取您的儲存空間的藝廊能做的事情寥寥無幾 編輯 開啟相機 - 未知錯誤 以其他應用軟體開啟 沒有可用的應用軟體 隱藏資料夾 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9e17e55c4..1a5a0d398 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,7 +6,6 @@ Not much to do in a gallery without accessing your storage Edit Open camera - An unknown error occurred Open with No valid app found Hide folder