aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-04-22 04:44:19 -0400
committerAllan Wang <me@allanwang.ca>2019-04-22 04:44:19 -0400
commit9df2a878226fb5f7adcf1af61a1ce87dff826fbc (patch)
treef2c9842ea5256842bef6e33fc5f8a086a729c636 /app
parentba0b4e70d93f91497a7bc157fe7f3838942dfb15 (diff)
downloadfrost-9df2a878226fb5f7adcf1af61a1ce87dff826fbc.tar.gz
frost-9df2a878226fb5f7adcf1af61a1ce87dff826fbc.tar.bz2
frost-9df2a878226fb5f7adcf1af61a1ce87dff826fbc.zip
Remove unnecessary id
Diffstat (limited to 'app')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt16
1 files changed, 4 insertions, 12 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 6ba0a3d6..4ddd7225 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt
@@ -34,15 +34,13 @@ import com.pitchedapps.frost.services.NOTIF_CHANNEL_GENERAL
import com.pitchedapps.frost.services.NotificationContent
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
-import com.pitchedapps.frost.widgets.NotificationWidget.Companion.NOTIF_WIDGET_IDS
-import com.pitchedapps.frost.widgets.NotificationWidget.Companion.NOTIF_WIDGET_TYPE
import org.koin.standalone.KoinComponent
import org.koin.standalone.inject
class NotificationWidget : AppWidgetProvider() {
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
super.onUpdate(context, appWidgetManager, appWidgetIds)
- val intent = NotificationWidgetService.createIntent(context, NOTIF_CHANNEL_GENERAL, appWidgetIds)
+ val intent = NotificationWidgetService.createIntent(context, NOTIF_CHANNEL_GENERAL)
for (id in appWidgetIds) {
val views = RemoteViews(context.packageName, R.layout.widget_notifications)
views.setBackgroundColor(R.id.widget_layout_container, Prefs.bgColor)
@@ -51,13 +49,10 @@ class NotificationWidget : AppWidgetProvider() {
}
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_notification_list)
}
-
- companion object {
- const val NOTIF_WIDGET_TYPE = "notif_widget_type"
- const val NOTIF_WIDGET_IDS = "notif_widget_ids"
- }
}
+private const val NOTIF_WIDGET_TYPE = "notif_widget_type"
+
private fun RemoteViews.setBackgroundColor(viewId: Int, @ColorInt color: Int) {
setInt(viewId, "setBackgroundColor", color)
}
@@ -66,10 +61,9 @@ class NotificationWidgetService : RemoteViewsService() {
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory = NotificationWidgetDataProvider(this, intent)
companion object {
- fun createIntent(context: Context, type: String, appWidgetIds: IntArray): Intent =
+ fun createIntent(context: Context, type: String): Intent =
Intent(context, NotificationWidgetService::class.java)
.putExtra(NOTIF_WIDGET_TYPE, type)
- .putExtra(NOTIF_WIDGET_IDS, appWidgetIds)
}
}
@@ -82,8 +76,6 @@ class NotificationWidgetDataProvider(val context: Context, val intent: Intent) :
private val type = intent.getStringExtra(NOTIF_WIDGET_TYPE)
- private val widgetIds = intent.getIntArrayExtra(NOTIF_WIDGET_IDS)
-
private val avatarSize = context.dimenPixelSize(R.dimen.avatar_image_size)
private val glide = GlideApp.with(context).asBitmap()