Commit 6e1cbb8d authored by Sébastien Toque's avatar Sébastien Toque
Browse files

Refresh mini audio player only if MainActivity is visible

parent 018fbcda
...@@ -106,7 +106,6 @@ public class MainActivity extends TabActivity { ...@@ -106,7 +106,6 @@ public class MainActivity extends TabActivity {
// add mini audio player // add mini audio player
mAudioPlayer = (AudioMiniPlayer) findViewById(R.id.audio_mini_player); mAudioPlayer = (AudioMiniPlayer) findViewById(R.id.audio_mini_player);
mAudioController = AudioServiceController.getInstance(); mAudioController = AudioServiceController.getInstance();
mAudioController.addAudioPlayer(mAudioPlayer);
mAudioPlayer.setAudioPlayerControl(mAudioController); mAudioPlayer.setAudioPlayerControl(mAudioController);
mAudioPlayer.update(); mAudioPlayer.update();
...@@ -141,6 +140,18 @@ public class MainActivity extends TabActivity { ...@@ -141,6 +140,18 @@ public class MainActivity extends TabActivity {
MediaLibrary.getInstance(this).loadMediaItems(); MediaLibrary.getInstance(this).loadMediaItems();
} }
@Override
protected void onStart() {
mAudioController.addAudioPlayer(mAudioPlayer);
super.onStart();
}
@Override
protected void onStop() {
mAudioController.removeAudioPlayer(mAudioPlayer);
super.onStop();
}
/** Create menu from XML /** Create menu from XML
*/ */
@Override @Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment