diff options
author | Allan Wang <me@allanwang.ca> | 2019-12-29 22:02:27 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-12-29 22:02:27 -0800 |
commit | 65d527155ed456b14de6cc036e95d5c6ade696ba (patch) | |
tree | 4c4a17a208444cd572915f86ffe612f00150c348 /app/src/main/kotlin/com | |
parent | 86df98094d202701690d597024558ccaa6d41abd (diff) | |
download | frost-65d527155ed456b14de6cc036e95d5c6ade696ba.tar.gz frost-65d527155ed456b14de6cc036e95d5c6ade696ba.tar.bz2 frost-65d527155ed456b14de6cc036e95d5c6ade696ba.zip |
Ignore ioobe for NotificationWidget, resolves #1520
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt index f660383f..7a37370d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt @@ -180,17 +180,21 @@ class NotificationWidgetDataProvider(val context: Context, val intent: Intent) : override fun getViewAt(position: Int): RemoteViews { val views = RemoteViews(context.packageName, R.layout.widget_notification_item) - val notif = content[position] - views.setBackgroundColor(R.id.item_frame, Prefs.nativeBgColor(notif.unread)) - views.setTextColor(R.id.item_content, Prefs.textColor) - views.setTextViewText(R.id.item_content, notif.text) - views.setTextColor(R.id.item_date, Prefs.textColor.withAlpha(150)) - views.setTextViewText(R.id.item_date, notif.timestamp.toReadableTime(context)) - - val avatar = glide.load(notif.profileUrl).transform(FrostGlide.circleCrop) - .submit(avatarSize, avatarSize).get() - views.setImageViewBitmap(R.id.item_avatar, avatar) - views.setOnClickFillInIntent(R.id.item_frame, type.putContentExtra(Intent(), notif)) + try { + val notif = content[position] + views.setBackgroundColor(R.id.item_frame, Prefs.nativeBgColor(notif.unread)) + views.setTextColor(R.id.item_content, Prefs.textColor) + views.setTextViewText(R.id.item_content, notif.text) + views.setTextColor(R.id.item_date, Prefs.textColor.withAlpha(150)) + views.setTextViewText(R.id.item_date, notif.timestamp.toReadableTime(context)) + + val avatar = glide.load(notif.profileUrl).transform(FrostGlide.circleCrop) + .submit(avatarSize, avatarSize).get() + views.setImageViewBitmap(R.id.item_avatar, avatar) + views.setOnClickFillInIntent(R.id.item_frame, type.putContentExtra(Intent(), notif)) + } catch (_: IndexOutOfBoundsException) { + // Ignored; seems like an Android bug + } return views } |