Fields Summary |
---|
private static final String | TAG |
public static final int | STATE_DISCONNECTED |
public static final int | STATE_CONNECTED |
protected android.media.session.MediaController | mController |
protected IPlayerService | mBinder |
protected MediaController.TransportControls | mTransportControls |
private final android.content.Intent | mServiceIntent |
private android.app.Activity | mContext |
private Listener | mListener |
private SessionCallback | mControllerCb |
private android.media.session.MediaSessionManager | mManager |
private android.os.Handler | mHandler |
private boolean | mResumed |
private android.graphics.Bitmap | mArt |
private android.content.ServiceConnection | mServiceConnection |
Methods Summary |
---|
private void | bindToService()
mContext.bindService(mServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
|
public MediaSession.Token | getSessionToken()
if (mBinder != null) {
try {
return mBinder.getSessionToken();
} catch (RemoteException e) {
}
}
return null;
|
public void | onPause()
mResumed = false;
Log.d(TAG, "onPause, unbinding from service");
unbindFromService();
|
public void | onResume()
mResumed = true;
Log.d(TAG, "onResume. Binding to service with intent " + mServiceIntent.toString());
bindToService();
|
public void | pause()
if (mTransportControls != null) {
mTransportControls.pause();
}
|
public void | play()
if (mTransportControls != null) {
mTransportControls.play();
}
|
public void | setArt(android.graphics.Bitmap art)
mArt = art;
if (mBinder != null) {
try {
mBinder.setIcon(art);
} catch (RemoteException e) {
}
}
|
public void | setContent(java.lang.String source)
RequestUtils.ContentBuilder bob = new RequestUtils.ContentBuilder();
bob.setSource(source);
try {
mBinder.sendRequest(RequestUtils.ACTION_SET_CONTENT, bob.build(), null);
} catch (RemoteException e) {
Log.d(TAG, "setContent failed, service may have died.", e);
}
|
public void | setListener(com.android.onemedia.PlayerController$Listener listener)
mListener = listener;
Log.d(TAG, "Listener set to " + listener + " session is " + mController);
if (mListener != null) {
mHandler = new Handler();
mListener.onConnectionStateChange(
mController == null ? STATE_DISCONNECTED : STATE_CONNECTED);
}
|
public void | setNextContent(java.lang.String source)
RequestUtils.ContentBuilder bob = new RequestUtils.ContentBuilder();
bob.setSource(source);
try {
mBinder.sendRequest(RequestUtils.ACTION_SET_NEXT_CONTENT, bob.build(), null);
} catch (RemoteException e) {
Log.d(TAG, "setNexctContent failed, service may have died.", e);
}
|
public void | showRoutePicker()
// TODO
|
private void | unbindFromService()
mContext.unbindService(mServiceConnection);
|