From 7117705225ce2e21770abe6789ab5badc0648833 Mon Sep 17 00:00:00 2001 From: Wilco van Beijnum Date: Sun, 13 May 2018 22:55:41 +0200 Subject: [PATCH] Fixed widgets --- .../wilco375/roosternotification/activity/MainActivity.kt | 2 +- .../roosternotification/widget/LesdagWidgetProvider.kt | 2 ++ .../roosternotification/widget/LesuurWidgetProvider.kt | 2 ++ app/src/main/res/layout/app_widget_lesdag.xml | 1 + app/src/main/res/layout/app_widget_lesuur.xml | 1 + app/src/main/res/values/color.xml | 6 +++--- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/wilco375/roosternotification/activity/MainActivity.kt b/app/src/main/java/com/wilco375/roosternotification/activity/MainActivity.kt index c68ac3b..0427e29 100644 --- a/app/src/main/java/com/wilco375/roosternotification/activity/MainActivity.kt +++ b/app/src/main/java/com/wilco375/roosternotification/activity/MainActivity.kt @@ -71,7 +71,7 @@ class MainActivity : CAppCompatActivity() { */ private fun checkInit() { if (sp.getString("token", "") == "" || sp.getString("website", "") == "") { - if(sp.getString("token", "") != null) { + if(sp.getString("token", "") != "") { // Coming from old app version sp.edit().putString("website", "jfc.zportal.nl").apply() syncSchedule() diff --git a/app/src/main/java/com/wilco375/roosternotification/widget/LesdagWidgetProvider.kt b/app/src/main/java/com/wilco375/roosternotification/widget/LesdagWidgetProvider.kt index 44afa58..a1bfb8d 100644 --- a/app/src/main/java/com/wilco375/roosternotification/widget/LesdagWidgetProvider.kt +++ b/app/src/main/java/com/wilco375/roosternotification/widget/LesdagWidgetProvider.kt @@ -12,6 +12,7 @@ import com.wilco375.roosternotification.R import com.wilco375.roosternotification.`object`.Schedule import com.wilco375.roosternotification.activity.MainActivity import com.wilco375.roosternotification.general.Utils +import io.multimoon.colorful.Colorful import java.util.* class LesdagWidgetProvider : AppWidgetProvider() { @@ -28,6 +29,7 @@ class LesdagWidgetProvider : AppWidgetProvider() { val views = RemoteViews(context.packageName, R.layout.app_widget_lesdag) views.setOnClickPendingIntent(R.id.app_widget_lesdag_layout, pendingIntent) views.setTextViewText(R.id.app_widget_lesdag_dag, Utils.currentDay()) + views.setInt(R.id.app_widget_lesdag_dag, "setBackgroundColor", Colorful().getPrimaryColor().getColorPack().normal().asInt()) var widgetText = "" diff --git a/app/src/main/java/com/wilco375/roosternotification/widget/LesuurWidgetProvider.kt b/app/src/main/java/com/wilco375/roosternotification/widget/LesuurWidgetProvider.kt index ddfb71e..3ec3b2c 100644 --- a/app/src/main/java/com/wilco375/roosternotification/widget/LesuurWidgetProvider.kt +++ b/app/src/main/java/com/wilco375/roosternotification/widget/LesuurWidgetProvider.kt @@ -12,6 +12,7 @@ import com.wilco375.roosternotification.R import com.wilco375.roosternotification.`object`.Schedule import com.wilco375.roosternotification.activity.MainActivity import com.wilco375.roosternotification.general.Utils +import io.multimoon.colorful.Colorful import java.util.* class LesuurWidgetProvider : AppWidgetProvider() { @@ -48,6 +49,7 @@ class LesuurWidgetProvider : AppWidgetProvider() { val views = RemoteViews(context.packageName, R.layout.app_widget_lesuur) views.setOnClickPendingIntent(R.id.app_widget_lesuur_layout, pendingIntent) + views.setInt(R.id.app_widget_lesuur_layout, "setBackgroundColor", Colorful().getPrimaryColor().getColorPack().normal().asInt()) if (!(subject == "" && location == "") && !cancelled) { if (timeslot != 0) diff --git a/app/src/main/res/layout/app_widget_lesdag.xml b/app/src/main/res/layout/app_widget_lesdag.xml index fd22535..009c4a6 100644 --- a/app/src/main/res/layout/app_widget_lesdag.xml +++ b/app/src/main/res/layout/app_widget_lesdag.xml @@ -1,5 +1,6 @@ - #0085ad - #00455A - #800085ad + #00ff00 + #1976D2 + #802196F3 \ No newline at end of file