Skip to content

Commit

Permalink
Status Widget (main window is shown on click) traccar#429
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-V-K committed Aug 24, 2023
1 parent d6289c7 commit e81fdec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/org/traccar/client/StatusWidget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.traccar.client

import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.ComponentName
Expand Down Expand Up @@ -52,6 +53,10 @@ class StatusWidget : AppWidgetProvider() {
for (appWidgetId in appWidgetIds) {
val views = RemoteViews(context.packageName, R.layout.status_widget)
views.setImageViewResource(R.id.image_enabled, if (enabled) R.mipmap.ic_start else R.mipmap.ic_stop)

val clickIntent = PendingIntent.getActivity(context,0, Intent(context, MainActivity::class.java),0)
views.setOnClickPendingIntent(R.id.image_enabled, clickIntent)

appWidgetManager.updateAppWidget(appWidgetId, views)
}
}
Expand Down

0 comments on commit e81fdec

Please sign in to comment.