From cd40d839fcc7146ab747eee8822d59fbd5579255 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Wed, 16 Jan 2013 15:37:29 +0100 Subject: Release PlaybackController when MediaplayerActivity is stopped --- .../antennapod/activity/MediaplayerActivity.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/de/danoeh/antennapod/activity') diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java index ef381739f..a53b4f4fb 100644 --- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -51,9 +51,8 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity protected ImageButton butRev; protected ImageButton butFF; - public MediaplayerActivity() { - super(); - controller = new PlaybackController(this, false) { + private PlaybackController newPlaybackController() { + return new PlaybackController(this, false) { @Override public void setupGUI() { @@ -130,6 +129,7 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity finish(); } }; + } protected void onServiceQueried() { @@ -184,11 +184,23 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity /** Current screen orientation. */ protected int orientation; + @Override + protected void onStart() { + super.onStart(); + if (controller != null) { + controller.release(); + } + controller = newPlaybackController(); + } + @Override protected void onStop() { super.onStop(); if (AppConfig.DEBUG) Log.d(TAG, "Activity stopped"); + if (controller != null) { + controller.release(); + } } @Override @@ -196,9 +208,6 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity super.onDestroy(); if (AppConfig.DEBUG) Log.d(TAG, "Activity destroyed"); - if (controller != null) { - controller.release(); - } } @Override -- cgit v1.2.3