From 81276cb8787ba26916e84d243e6ca9c681947687 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 18 Dec 2018 09:55:28 +0100 Subject: [PATCH] catch exceptions at filling the widget --- app/build.gradle | 2 +- .../gallery/pro/helpers/MyWidgetProvider.kt | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f6404d273..c5aeb6402 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ dependencies { //implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0' //implementation 'com.github.tibbi:subsampling-scale-image-view:v3.10.1-fork' - implementation 'com.github.tibbi:subsampling-scale-image-view:4.0.0' + implementation 'com.github.tibbi:subsampling-scale-image-view:fcb724fb0a' // implementation 'com.github.chrisbanes:PhotoView:2.3.0' implementation 'com.github.tibbi:PhotoView:2.3.0-fork' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyWidgetProvider.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyWidgetProvider.kt index 44886cefd..61c892d46 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyWidgetProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyWidgetProvider.kt @@ -52,14 +52,16 @@ class MyWidgetProvider : AppWidgetProvider() { val height = appWidgetOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT) val widgetSize = (Math.max(width, height) * density).toInt() - val image = Glide.with(context) - .asBitmap() - .load(path) - .apply(options) - .submit(widgetSize, widgetSize) - .get() - - views.setImageViewBitmap(R.id.widget_imageview, image) + try { + val image = Glide.with(context) + .asBitmap() + .load(path) + .apply(options) + .submit(widgetSize, widgetSize) + .get() + views.setImageViewBitmap(R.id.widget_imageview, image) + } catch (e: Exception) { + } setupAppOpenIntent(context, views, R.id.widget_holder, it) appWidgetManager.updateAppWidget(it.widgetId, views)