From e9f46bd71d247ec207a4c96dde3e12f1af22ff5f Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 29 Nov 2015 12:07:29 -0500 Subject: [PATCH] make sure we stop updates when we're supposed to --- .../de/danoeh/antennapod/receiver/PlayerWidget.java | 12 ++++++++++++ app/src/main/res/xml/player_widget_info.xml | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java b/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java index 6d4d9bcd3..7f6dce09c 100644 --- a/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java @@ -40,6 +40,18 @@ public class PlayerWidget extends AppWidgetProvider { startUpdate(context); } + @Override + public void onDisabled(Context context) { + super.onDisabled(context); + stopUpdate(context); + } + + @Override + public void onDeleted(Context context, int[] appWidgetIds) { + super.onDeleted(context, appWidgetIds); + stopUpdate(context); + } + private void startUpdate(Context context) { Log.d(TAG, "startUpdate() called with: " + "context = [" + context + "]"); context.startService(new Intent(context, PlayerWidgetService.class)); diff --git a/app/src/main/res/xml/player_widget_info.xml b/app/src/main/res/xml/player_widget_info.xml index 831f6daf0..4033c3670 100644 --- a/app/src/main/res/xml/player_widget_info.xml +++ b/app/src/main/res/xml/player_widget_info.xml @@ -1,4 +1,9 @@ - + \ No newline at end of file