コード例 #1
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public void selectRoute(Object paramObject1, int paramInt, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.RouteInfo localRouteInfo = (MediaRouter.RouteInfo)paramObject2;
   int i = localRouteInfo.getSupportedTypes();
   if (((0x800000 & i) != 0) || (this.mSelectRouteIntMethod != null));
   while (true)
   {
     try
     {
       Method localMethod = this.mSelectRouteIntMethod;
       Object[] arrayOfObject = new Object[2];
       Integer localInteger = Integer.valueOf(paramInt);
       arrayOfObject[0] = localInteger;
       arrayOfObject[1] = localRouteInfo;
       Object localObject = localMethod.invoke(localMediaRouter, arrayOfObject);
       return;
     }
     catch (IllegalAccessException localIllegalAccessException)
     {
       int j = Log.w("MediaRouterJellybean", "Cannot programmatically select non-user route.  Media routing may not work.", localIllegalAccessException);
       localMediaRouter.selectRoute(paramInt, localRouteInfo);
       return;
     }
     catch (InvocationTargetException localInvocationTargetException)
     {
       int k = Log.w("MediaRouterJellybean", "Cannot programmatically select non-user route.  Media routing may not work.", localInvocationTargetException);
       continue;
     }
     int m = Log.w("MediaRouterJellybean", "Cannot programmatically select non-user route because the platform is missing the selectRouteInt() method.  Media routing may not work.");
   }
 }
コード例 #2
0
  void updateRouteCount() {
    final int N = mRouter.getRouteCount();
    int count = 0;
    boolean hasVideoRoutes = false;
    for (int i = 0; i < N; i++) {
      final RouteInfo route = mRouter.getRouteAt(i);
      final int routeTypes = route.getSupportedTypes();
      if ((routeTypes & mRouteTypes) != 0) {
        if (route instanceof RouteGroup) {
          count += ((RouteGroup) route).getRouteCount();
        } else {
          count++;
        }
        if ((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO) != 0) {
          hasVideoRoutes = true;
        }
      }
    }

    setEnabled(count != 0);

    // Only allow toggling if we have more than just user routes.
    // Don't toggle if we support video routes, we may have to let the dialog scan.
    mToggleMode =
        count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0 && !hasVideoRoutes;
  }
コード例 #3
0
 @SuppressWarnings({"rawtypes", "unchecked"})
 public static List getCategories(Object routerObj) {
   final android.media.MediaRouter router = (android.media.MediaRouter) routerObj;
   final int count = router.getCategoryCount();
   List out = new ArrayList(count);
   for (int i = 0; i < count; i++) {
     out.add(router.getCategoryAt(i));
   }
   return out;
 }
コード例 #4
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static List getRoutes(Object paramObject)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject;
   int i = localMediaRouter.getRouteCount();
   ArrayList localArrayList = new ArrayList(i);
   int j = 0;
   while (j < i)
   {
     MediaRouter.RouteInfo localRouteInfo = localMediaRouter.getRouteAt(j);
     boolean bool = localArrayList.add(localRouteInfo);
     j += 1;
   }
   return localArrayList;
 }
コード例 #5
0
    public Object getDefaultRoute(Object routerObj) {
      android.media.MediaRouter router = (android.media.MediaRouter) routerObj;

      if (mGetSystemAudioRouteMethod != null) {
        try {
          return mGetSystemAudioRouteMethod.invoke(router);
        } catch (IllegalAccessException ex) {
        } catch (InvocationTargetException ex) {
        }
      }

      // Could not find the method or it does not work.
      // Return the first route and hope for the best.
      return router.getRouteAt(0);
    }
コード例 #6
0
 @Override
 public void onDetachedFromWindow() {
   if (mRouteTypes != 0) {
     mRouter.removeCallback(mRouterCallback);
   }
   mAttachedToWindow = false;
   super.onDetachedFromWindow();
 }
コード例 #7
0
  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);
    }
  }
コード例 #8
0
ファイル: Player.java プロジェクト: maxplayer2013/maxplayer
 public boolean presentationRouteSelected() {
   boolean ret = false;
   MediaRouter.RouteInfo info = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
   Display pD = info.getPresentationDisplay();
   if (pD != null && pD.getDisplayId() != Display.DEFAULT_DISPLAY) {
     ret = true;
   }
   return ret;
 }
コード例 #9
0
 @Override
 public void onAttachedToWindow() {
   super.onAttachedToWindow();
   mAttachedToWindow = true;
   if (mRouteTypes != 0) {
     mRouter.addCallback(mRouteTypes, mRouterCallback);
     updateRouteInfo();
   }
 }
コード例 #10
0
  void updateRemoteIndicator() {
    final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
    final boolean isRemote = selected != mRouter.getSystemAudioRoute();
    final boolean isConnecting = selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;

    boolean needsRefresh = false;
    if (mRemoteActive != isRemote) {
      mRemoteActive = isRemote;
      needsRefresh = true;
    }
    if (mIsConnecting != isConnecting) {
      mIsConnecting = isConnecting;
      needsRefresh = true;
    }

    if (needsRefresh) {
      refreshDrawableState();
    }
  }
コード例 #11
0
  @Override
  public boolean performClick() {
    // Send the appropriate accessibility events and call listeners
    boolean handled = super.performClick();
    if (!handled) {
      playSoundEffect(SoundEffectConstants.CLICK);
    }

    if (mToggleMode) {
      if (mRemoteActive) {
        mRouter.selectRouteInt(mRouteTypes, mRouter.getSystemAudioRoute());
      } else {
        final int N = mRouter.getRouteCount();
        for (int i = 0; i < N; i++) {
          final RouteInfo route = mRouter.getRouteAt(i);
          if ((route.getSupportedTypes() & mRouteTypes) != 0
              && route != mRouter.getSystemAudioRoute()) {
            mRouter.selectRouteInt(mRouteTypes, route);
          }
        }
      }
    } else {
      showDialog();
    }

    return handled;
  }
コード例 #12
0
    public void selectRoute(Object routerObj, int types, Object routeObj) {
      android.media.MediaRouter router = (android.media.MediaRouter) routerObj;
      android.media.MediaRouter.RouteInfo route = (android.media.MediaRouter.RouteInfo) routeObj;

      int routeTypes = route.getSupportedTypes();
      if ((routeTypes & ROUTE_TYPE_USER) == 0) {
        // Handle non-user routes.
        // On JB and JB MR1, the selectRoute() API only supports programmatically
        // selecting user routes.  So instead we rely on the hidden selectRouteInt()
        // method on these versions of the platform.
        // This limitation was removed in JB MR2.
        if (mSelectRouteIntMethod != null) {
          try {
            mSelectRouteIntMethod.invoke(router, types, route);
            return; // success!
          } catch (IllegalAccessException ex) {
            Log.w(
                TAG,
                "Cannot programmatically select non-user route.  " + "Media routing may not work.",
                ex);
          } catch (InvocationTargetException ex) {
            Log.w(
                TAG,
                "Cannot programmatically select non-user route.  " + "Media routing may not work.",
                ex);
          }
        } else {
          Log.w(
              TAG,
              "Cannot programmatically select non-user route "
                  + "because the platform is missing the selectRouteInt() "
                  + "method.  Media routing may not work.");
        }
      }

      // Default handling.
      router.selectRoute(types, route);
    }
コード例 #13
0
ファイル: Player.java プロジェクト: maxplayer2013/maxplayer
  @Override
  protected void onResume() {
    if (presentationRouteSelected()) {
      mBackgroundImage.setImageResource(R.drawable.miracast);
      /*
       * if(MySlideShowPlayer.isImage){ showSlidingController(); }
       */
    } else {
      mBackgroundImage.setImageResource(R.drawable.background);
    }

    if (MySlideShowPlayer.isImage) {
      showSlidingController();
    }

    Leg.i(TAG, "onResume()============================================================");
    doBindPlaybackService();
    mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_LIVE_VIDEO, mMediaRouterCallback);
    mSurfaceHolder.addCallback(mFgSurfaceHolderCB);
    PlaybackService.STOP_SERVICE_ON_COMPLETE = false;
    super.onResume();
  }
コード例 #14
0
ファイル: Player.java プロジェクト: maxplayer2013/maxplayer
  @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();
  }
コード例 #15
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static void removeUserRoute(Object paramObject1, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.UserRouteInfo localUserRouteInfo = (MediaRouter.UserRouteInfo)paramObject2;
   localMediaRouter.removeUserRoute(localUserRouteInfo);
 }
コード例 #16
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static void addCallback(Object paramObject1, int paramInt, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.Callback localCallback = (MediaRouter.Callback)paramObject2;
   localMediaRouter.addCallback(paramInt, localCallback);
 }
コード例 #17
0
 public static void selectRoute(Object paramObject1, int paramInt, Object paramObject2) {
   ((MediaRouter) paramObject1).selectRoute(paramInt, (MediaRouter.RouteInfo) paramObject2);
 }
コード例 #18
0
 public static void removeUserRoute(Object paramObject1, Object paramObject2) {
   ((MediaRouter) paramObject1).removeUserRoute((MediaRouter.UserRouteInfo) paramObject2);
 }
コード例 #19
0
 public static void removeCallback(Object paramObject1, Object paramObject2) {
   ((MediaRouter) paramObject1).removeCallback((MediaRouter.Callback) paramObject2);
 }
コード例 #20
0
 public static void addCallback(Object paramObject1, int paramInt, Object paramObject2) {
   ((MediaRouter) paramObject1).addCallback(paramInt, (MediaRouter.Callback) paramObject2);
 }
コード例 #21
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static Object createUserRoute(Object paramObject1, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.RouteCategory localRouteCategory = (MediaRouter.RouteCategory)paramObject2;
   return localMediaRouter.createUserRoute(localRouteCategory);
 }
コード例 #22
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static void selectRoute(Object paramObject1, int paramInt, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.RouteInfo localRouteInfo = (MediaRouter.RouteInfo)paramObject2;
   localMediaRouter.selectRoute(paramInt, localRouteInfo);
 }
コード例 #23
0
ファイル: MediaRouterJellybean.java プロジェクト: vovs/GMusic
 public static void removeCallback(Object paramObject1, Object paramObject2)
 {
   MediaRouter localMediaRouter = (MediaRouter)paramObject1;
   MediaRouter.Callback localCallback = (MediaRouter.Callback)paramObject2;
   localMediaRouter.removeCallback(localCallback);
 }