fix bug that caused ExternalPlayerFragment to not always be shown
This commit is contained in:
parent
b090e2bf65
commit
c097b672d6
|
@ -141,26 +141,12 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShutdownNotification() {
|
public void onShutdownNotification() {
|
||||||
if (fragmentLayout != null) {
|
playbackDone();
|
||||||
fragmentLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
controller = setupPlaybackController();
|
|
||||||
if (butPlay != null) {
|
|
||||||
butPlay.setOnClickListener(controller
|
|
||||||
.newOnPlayButtonClickListener());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackEnd() {
|
public void onPlaybackEnd() {
|
||||||
if (fragmentLayout != null) {
|
playbackDone();
|
||||||
fragmentLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
controller = setupPlaybackController();
|
|
||||||
if (butPlay != null) {
|
|
||||||
butPlay.setOnClickListener(controller
|
|
||||||
.newOnPlayButtonClickListener());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() {
|
private boolean loadMediaInfo() {
|
||||||
Log.d(TAG, "Loading media info");
|
Log.d(TAG, "Loading media info");
|
||||||
if (controller != null && controller.serviceAvailable()) {
|
if (controller != null && controller.serviceAvailable()) {
|
||||||
|
|
|
@ -120,6 +120,7 @@ public abstract class PlaybackController {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Can't call init() after release() has been called");
|
"Can't call init() after release() has been called");
|
||||||
}
|
}
|
||||||
|
checkMediaInfoLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue