コード例 #1
0
 public Callback() {
   if (android.os.Build.VERSION.SDK_INT >= 21) {
     mCallbackObj = MediaControllerCompatApi21.createCallback(new StubApi21());
   } else {
     mCallbackObj = null;
   }
 }
コード例 #2
0
 @Override
 public PlaybackInfo getPlaybackInfo() {
   Object volumeInfoObj = MediaControllerCompatApi21.getPlaybackInfo(mControllerObj);
   return volumeInfoObj != null
       ? new PlaybackInfo(
           MediaControllerCompatApi21.PlaybackInfo.getPlaybackType(volumeInfoObj),
           MediaControllerCompatApi21.PlaybackInfo.getLegacyAudioStream(volumeInfoObj),
           MediaControllerCompatApi21.PlaybackInfo.getVolumeControl(volumeInfoObj),
           MediaControllerCompatApi21.PlaybackInfo.getMaxVolume(volumeInfoObj),
           MediaControllerCompatApi21.PlaybackInfo.getCurrentVolume(volumeInfoObj))
       : null;
 }
コード例 #3
0
 @Override
 public void sendCommand(String command, Bundle params, ResultReceiver cb) {
   MediaControllerCompatApi21.sendCommand(mControllerObj, command, params, cb);
 }
コード例 #4
0
 @Override
 public int getRatingType() {
   return MediaControllerCompatApi21.getRatingType(mControllerObj);
 }
コード例 #5
0
 @Override
 public MediaMetadataCompat getMetadata() {
   Object metadataObj = MediaControllerCompatApi21.getMetadata(mControllerObj);
   return metadataObj != null ? MediaMetadataCompat.fromMediaMetadata(metadataObj) : null;
 }
コード例 #6
0
 @Override
 public PlaybackStateCompat getPlaybackState() {
   Object stateObj = MediaControllerCompatApi21.getPlaybackState(mControllerObj);
   return stateObj != null ? PlaybackStateCompat.fromPlaybackState(stateObj) : null;
 }
コード例 #7
0
 @Override
 public TransportControls getTransportControls() {
   Object controlsObj = MediaControllerCompatApi21.getTransportControls(mControllerObj);
   return controlsObj != null ? new TransportControlsApi21(controlsObj) : null;
 }
コード例 #8
0
 @Override
 public boolean dispatchMediaButtonEvent(KeyEvent event) {
   return MediaControllerCompatApi21.dispatchMediaButtonEvent(mControllerObj, event);
 }
コード例 #9
0
 @Override
 public void unregisterCallback(Callback callback) {
   MediaControllerCompatApi21.unregisterCallback(mControllerObj, callback.mCallbackObj);
 }
コード例 #10
0
 @Override
 public void registerCallback(Callback callback, Handler handler) {
   MediaControllerCompatApi21.registerCallback(mControllerObj, callback.mCallbackObj, handler);
 }
コード例 #11
0
 public MediaControllerImplApi21(Context context, MediaSessionCompat.Token sessionToken)
     throws RemoteException {
   // TODO: refactor framework implementation
   mControllerObj = MediaControllerCompatApi21.fromToken(context, sessionToken.getToken());
   if (mControllerObj == null) throw new RemoteException();
 }
コード例 #12
0
 public MediaControllerImplApi21(Context context, MediaSessionCompat session) {
   mControllerObj =
       MediaControllerCompatApi21.fromToken(context, session.getSessionToken().getToken());
 }