@Override
 public void onDetachedFromWindow() {
   if (mRouteTypes != 0) {
     mRouter.removeCallback(mRouterCallback);
   }
   mAttachedToWindow = false;
   super.onDetachedFromWindow();
 }
  public void setRouteTypes(int types) {
    if (types == mRouteTypes) {
      // Already registered; nothing to do.
      return;
    }

    if (mAttachedToWindow && mRouteTypes != 0) {
      mRouter.removeCallback(mRouterCallback);
    }

    mRouteTypes = types;

    if (mAttachedToWindow) {
      updateRouteInfo();
      mRouter.addCallback(types, mRouterCallback);
    }
  }
Exemple #3
0
  @Override
  protected void onPause() {
    Leg.i(
        TAG,
        "onPause()==============================================================================");

    MyMediaPlayer.PLAYBACK_STATE state = mPlaybackService.getPlaybackState();
    Leg.i(TAG, "current play state is: " + state);
    switch (state) {
      case PAUSED:
        break;
      case PLAYING:
        Leg.i(TAG, "going to start background pb");
        startPlaybackInService(false, false);
        break;
      default:
        break;
    }

    mMediaRouter.removeCallback(mMediaRouterCallback);
    PlaybackService.STOP_SERVICE_ON_COMPLETE = true;
    doUnbindPlaybackService();
    super.onPause();
  }
 public static void removeCallback(Object paramObject1, Object paramObject2) {
   ((MediaRouter) paramObject1).removeCallback((MediaRouter.Callback) paramObject2);
 }
 public static void removeCallback(Object paramObject1, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.Callback localCallback = (MediaRouter.Callback)paramObject2;
   localMediaRouter.removeCallback(localCallback);
 }