|
@@ -7,7 +7,9 @@ import android.appwidget.AppWidgetProvider
|
|
|
import android.content.ComponentName
|
|
|
import android.content.Context
|
|
|
import android.content.Intent
|
|
|
+import android.graphics.Color
|
|
|
import android.util.Log
|
|
|
+import android.widget.RemoteViews
|
|
|
import androidx.core.content.ContextCompat.getSystemService
|
|
|
|
|
|
|
|
@@ -24,6 +26,14 @@ class HomeTempAppWidget : AppWidgetProvider() {
|
|
|
|
|
|
val thisWidget = ComponentName(context,HomeTempAppWidget::class.java)
|
|
|
val allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget)
|
|
|
+ val remoteViews = RemoteViews(context.packageName, R.layout.home_temp_app_widget )
|
|
|
+
|
|
|
+ for (widgetId in allWidgetIds!!) {
|
|
|
+ Log.i("SERVICE", "Set gray")
|
|
|
+ remoteViews.setTextColor(R.id.appwidget_text, Color.LTGRAY)
|
|
|
+ appWidgetManager.updateAppWidget(widgetId, remoteViews)
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// Build the intent to call the service
|
|
|
val intent = Intent(context.applicationContext,UpdateWidgetService::class.java)
|
|
@@ -31,7 +41,6 @@ class HomeTempAppWidget : AppWidgetProvider() {
|
|
|
|
|
|
// Update the widgets via the service
|
|
|
context.startService(intent);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|