Current playlist will now be shown whenever a renderer is selected.
This commit is contained in:
parent
e4afabe96a
commit
8455fac93d
2 changed files with 11 additions and 5 deletions
|
@ -283,9 +283,7 @@ public class RendererFragment extends Fragment implements
|
|||
}
|
||||
|
||||
private void selectRenderer(Device<?, ?, ?> renderer) {
|
||||
if (mCurrentRenderer != renderer) {
|
||||
if (mCurrentRenderer != null)
|
||||
mPlayService.getService().pause();
|
||||
if (mCurrentRenderer != renderer) {
|
||||
if (mSubscriptionCallback != null)
|
||||
mSubscriptionCallback.end();
|
||||
|
||||
|
@ -308,6 +306,7 @@ public class RendererFragment extends Fragment implements
|
|||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
protected void eventReceived(final GENASubscription sub) {
|
||||
if (getActivity() == null) return;
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
|
@ -358,6 +357,8 @@ public class RendererFragment extends Fragment implements
|
|||
};
|
||||
mUpnpService.getControlPoint().execute(mSubscriptionCallback);
|
||||
}
|
||||
mPlaylistAdapter.clear();
|
||||
mPlaylistAdapter.addAll(mPlayService.getService().getPlaylist());
|
||||
mListView.setAdapter(mPlaylistAdapter);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.teleal.cling.model.message.UpnpResponse;
|
|||
import org.teleal.cling.model.meta.Device;
|
||||
import org.teleal.cling.model.state.StateVariableValue;
|
||||
import org.teleal.cling.model.types.ServiceType;
|
||||
import org.teleal.cling.support.avtransport.callback.Pause;
|
||||
import org.teleal.cling.support.avtransport.callback.Play;
|
||||
import org.teleal.cling.support.avtransport.callback.SetAVTransportURI;
|
||||
import org.teleal.cling.support.avtransport.callback.Stop;
|
||||
|
@ -226,7 +227,7 @@ public class PlayService extends Service {
|
|||
public void pause() {
|
||||
mManuallyStopped.set(true);
|
||||
mUpnpService.getControlPoint().execute(
|
||||
new Stop(mAvTransportService) {
|
||||
new Pause(mAvTransportService) {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
|
@ -250,7 +251,7 @@ public class PlayService extends Service {
|
|||
public void setRenderer(Device<?, ?, ?> renderer) {
|
||||
if (mSubscriptionCallback != null)
|
||||
mSubscriptionCallback.end();
|
||||
if (mRenderer != null)
|
||||
if (mRenderer != null && renderer != mRenderer)
|
||||
pause();
|
||||
|
||||
mRenderer = renderer;
|
||||
|
@ -349,5 +350,9 @@ public class PlayService extends Service {
|
|||
public void playPrevious() {
|
||||
playTrack(mCurrentTrack - 1);
|
||||
}
|
||||
|
||||
public List<Item> getPlaylist() {
|
||||
return mPlaylist;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue