catch exceptions at filling the widget

This commit is contained in:
tibbi 2018-12-18 09:55:28 +01:00
parent f7e126d69e
commit 81276cb878
2 changed files with 11 additions and 9 deletions

View file

@ -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'

View file

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