fix bug that caused ExternalPlayerFragment to not always be shown

This commit is contained in:
Tom Hennen 2015-09-26 11:11:48 -04:00
parent b090e2bf65
commit c097b672d6
2 changed files with 18 additions and 16 deletions

View File

@ -141,26 +141,12 @@ public class ExternalPlayerFragment extends Fragment {
@Override
public void onShutdownNotification() {
if (fragmentLayout != null) {
fragmentLayout.setVisibility(View.GONE);
}
controller = setupPlaybackController();
if (butPlay != null) {
butPlay.setOnClickListener(controller
.newOnPlayButtonClickListener());
}
playbackDone();
}
@Override
public void onPlaybackEnd() {
if (fragmentLayout != null) {
fragmentLayout.setVisibility(View.GONE);
}
controller = setupPlaybackController();
if (butPlay != null) {
butPlay.setOnClickListener(controller
.newOnPlayButtonClickListener());
}
playbackDone();
}
@Override
@ -192,6 +178,21 @@ public class ExternalPlayerFragment extends Fragment {
}
}
private void playbackDone() {
if (fragmentLayout != null) {
fragmentLayout.setVisibility(View.GONE);
}
if (controller != null) {
controller.release();
}
controller = setupPlaybackController();
if (butPlay != null) {
butPlay.setOnClickListener(controller
.newOnPlayButtonClickListener());
}
controller.init();
}
private boolean loadMediaInfo() {
Log.d(TAG, "Loading media info");
if (controller != null && controller.serviceAvailable()) {

View File

@ -120,6 +120,7 @@ public abstract class PlaybackController {
throw new IllegalStateException(
"Can't call init() after release() has been called");
}
checkMediaInfoLoaded();
}
/**