From 2c4bbfb0e2f31f7479f587199eb91b39d61744d2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Jan 2017 23:05:25 +0100 Subject: [PATCH] make sure there is an application with maps before sending the intent --- .../gallery/activities/ViewPagerActivity.kt | 7 ++++++- 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, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 1325d6111..096b32d4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -175,7 +175,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val encodedQuery = Uri.encode(query) val uriString = "$uriBegin?q=$encodedQuery&z=16" val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uriString)) - startActivity(intent) + val packageManager = packageManager + if (intent.resolveActivity(packageManager) != null) { + startActivity(intent) + } else { + toast(R.string.no_map_application) + } } } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1a4c67577..db717befb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -21,6 +21,7 @@ andere Ordner Show on map Unknown location + No application with maps has been found Größe ändern diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 38e4c1623..3c6f8907e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -21,6 +21,7 @@ Other folder Show on map Unknown location + No application with maps has been found Resize diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7579ca2ea..72c7e751c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -21,6 +21,7 @@ Autre dossier Show on map Unknown location + No application with maps has been found Redimensionner diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index eb93c0d19..a2273acc8 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -21,6 +21,7 @@ Other folder Show on map Unknown location + No application with maps has been found Resize diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index fd12c52a4..3d357272b 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -21,6 +21,7 @@ Other folder Show on map Unknown location + No application with maps has been found Resize diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 45f6ad29a..54d6bf0a9 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -21,6 +21,7 @@ Outra pasta Mostrar no mapa Localização desconhecida + No application with maps has been found Redimensionar diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6740ee33f..77a0abbc6 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -21,6 +21,7 @@ Другая папка Show on map Unknown location + No application with maps has been found Изменить размер diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 456716ad0..ec6b740a6 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -21,6 +21,7 @@ Andra mappar Show on map Unknown location + No application with maps has been found Ändra storlek diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index bc4f3dc74..0504b1cd8 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -21,6 +21,7 @@ 其他文件夹 Show on map Unknown location + No application with maps has been found 缩放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 9ef5f3832..edad80f2b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -21,6 +21,7 @@ 其他資料夾 Show on map Unknown location + No application with maps has been found 縮放 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d3b67f307..6a1aa6e00 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -21,6 +21,7 @@ Other folder Show on map Unknown location + No application with maps has been found Resize