Пример #1
0
 @Override
 public boolean equals(Object o) {
   if (o instanceof MediaRouteSelector) {
     MediaRouteSelector other = (MediaRouteSelector) o;
     ensureControlCategories();
     other.ensureControlCategories();
     return mControlCategories.equals(other.mControlCategories);
   }
   return false;
 }
Пример #2
0
    /**
     * Adds the contents of an existing media route selector to the builder.
     *
     * @param selector The media route selector whose contents are to be added.
     * @return The builder instance for chaining.
     */
    public Builder addSelector(MediaRouteSelector selector) {
      if (selector == null) {
        throw new IllegalArgumentException("selector must not be null");
      }

      addControlCategories(selector.getControlCategories());
      return this;
    }
Пример #3
0
 /**
  * Returns true if this selector contains all of the capabilities described by the specified
  * selector.
  *
  * @param selector The selector to be examined.
  * @return True if this selector contains all of the capabilities described by the specified
  *     selector.
  */
 public boolean contains(MediaRouteSelector selector) {
   if (selector != null) {
     ensureControlCategories();
     selector.ensureControlCategories();
     return mControlCategories.containsAll(selector.mControlCategories);
   }
   return false;
 }
  @Override
  public void onDetachedFromWindow() {
    mAttachedToWindow = false;
    if (!mSelector.isEmpty()) {
      mRouter.removeCallback(mCallback);
    }

    super.onDetachedFromWindow();
  }
  /**
   * Sets the media route selector for filtering the routes that the user can select using the media
   * route chooser dialog.
   *
   * @param selector The selector, must not be null.
   */
  public void setRouteSelector(MediaRouteSelector selector) {
    if (selector == null) {
      throw new IllegalArgumentException("selector must not be null");
    }

    if (!mSelector.equals(selector)) {
      if (mAttachedToWindow) {
        if (!mSelector.isEmpty()) {
          mRouter.removeCallback(mCallback);
        }
        if (!selector.isEmpty()) {
          mRouter.addCallback(selector, mCallback);
        }
      }
      mSelector = selector;
      refreshRoute();
    }
  }
Пример #6
0
    /**
     * Creates a media route selector descriptor builder whose initial contents are copied from an
     * existing selector.
     */
    public Builder(MediaRouteSelector selector) {
      if (selector == null) {
        throw new IllegalArgumentException("selector must not be null");
      }

      selector.ensureControlCategories();
      if (!selector.mControlCategories.isEmpty()) {
        mControlCategories = new ArrayList<String>(selector.mControlCategories);
      }
    }
  @Override
  public void onAttachedToWindow() {
    super.onAttachedToWindow();

    mAttachedToWindow = true;
    if (!mSelector.isEmpty()) {
      mRouter.addCallback(mSelector, mCallback);
    }
    refreshRoute();
  }