Android MediaRouter.RouteInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MediaRouter.RouteInfo class.

This code example shows how to use the following methods:getCategory, getGroup, getIconDrawable, getName, getStatus
            return convertView;
        } 
 
        void bindItemView(int position, ViewHolder holder) {
            RouteInfo info = (RouteInfo) mItems.get(position);
            holder.text1.setText(info.getName(getActivity()));
            final CharSequence status = info.getStatus();
            if (TextUtils.isEmpty(status)) {
                holder.text2.setVisibility(View.GONE);
            } else { 
                holder.text2.setVisibility(View.VISIBLE);
                holder.text2.setText(status);
            } 
            Drawable icon = info.getIconDrawable();
            if (icon != null) {
                // Make sure we have a fresh drawable where it doesn't matter if we mutate it 
                icon = icon.getConstantState().newDrawable(getResources());
            } 
            holder.icon.setImageDrawable(icon);
            holder.icon.setVisibility(icon != null ? View.VISIBLE : View.GONE);

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPresentationDisplay, isEnabled
  private void handleRoute(RouteInfo route) {
    if (route == null) {
      clearPreso(true); 
    } 
    else { 
      Display display=route.getPresentationDisplay();
 
      if (route.isEnabled() && display != null) {
        if (preso == null) {
          showPreso(route);
          Log.d(getClass().getSimpleName(), "enabled route");
        } 
        else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
          clearPreso(true); 
          showPreso(route);
          Log.d(getClass().getSimpleName(), "switched route");
        } 
        else { 
          // no-op: should already be set 
        } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPresentationDisplay, isEnabled
  private void handleRoute(RouteInfo route) {
    if (route == null) {
      clearPreso(); 
    } 
    else { 
      Display display=route.getPresentationDisplay();
 
      if (route.isEnabled() && display != null) {
        if (preso == null) {
          showPreso(route);
          Log.d(getClass().getSimpleName(), "enabled route");
        } 
        else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
          clearPreso(); 
          showPreso(route);
          Log.d(getClass().getSimpleName(), "switched route");
        } 
        else { 
          // no-op: should already be set 
        } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPresentationDisplay, isEnabled
  private void handleRoute(RouteInfo route) {
    if (route == null) {
      clearPreso(true); 
    } 
    else { 
      Display display=route.getPresentationDisplay();
 
      if (route.isEnabled() && display != null) {
        if (preso == null) {
          showPreso(route);
          Log.d(getClass().getSimpleName(), "enabled route");
        } 
        else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
          clearPreso(true); 
          showPreso(route);
          Log.d(getClass().getSimpleName(), "switched route");
        } 
        else { 
          // no-op: should already be set 
        } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getVolumeHandling, getVolumeMax, requestSetVolume
 
    void changeVolume(int newValue) {
        if (mIgnoreSliderVolumeChanges) return;
 
        final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
        if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
            final int maxVolume = selectedRoute.getVolumeMax();
            newValue = Math.max(0, Math.min(newValue, maxVolume));
            selectedRoute.requestSetVolume(newValue);
        } 
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        mInflater = inflater;
        final View layout = inflater.inflate(R.layout.media_route_chooser_layout, container, false);
 
        mVolumeIcon = (ImageView) layout.findViewById(R.id.volume_icon);
        mVolumeSlider = (SeekBar) layout.findViewById(R.id.volume_slider);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPresentationDisplay, isEnabled
  private void handleRoute(RouteInfo route) {
    if (route == null) {
      clearPreso(); 
    } 
    else { 
      Display display=route.getPresentationDisplay();
 
      if (route.isEnabled() && display != null) {
        if (preso == null) {
          showPreso(route);
          Log.d(getClass().getSimpleName(), "enabled route");
        } 
        else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
          clearPreso(); 
          showPreso(route);
          Log.d(getClass().getSimpleName(), "switched route");
        } 
        else { 
          // no-op: should already be set 
        } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCategory, getGroup, getIconDrawable, getName, getStatus
            return convertView;
        } 
 
        void bindItemView(int position, ViewHolder holder) {
            RouteInfo info = (RouteInfo) mItems.get(position);
            holder.text1.setText(info.getName(getActivity()));
            final CharSequence status = info.getStatus();
            if (TextUtils.isEmpty(status)) {
                holder.text2.setVisibility(View.GONE);
            } else { 
                holder.text2.setVisibility(View.VISIBLE);
                holder.text2.setText(status);
            } 
            Drawable icon = info.getIconDrawable();
            if (icon != null) {
                // Make sure we have a fresh drawable where it doesn't matter if we mutate it 
                icon = icon.getConstantState().newDrawable(getResources());
            } 
            holder.icon.setImageDrawable(icon);
            holder.icon.setVisibility(icon != null ? View.VISIBLE : View.GONE);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCategory
            @Override 
            public void onClick(View v) {
                // Assumption: this is only available for the user to click if we're presenting 
                // a groupable category, where every top-level route in the category is a group. 
                final RouteGroup group = (RouteGroup) getItem(position);
                mEditingGroup = group;
                mCategoryEditingGroups = group.getCategory();
                getDialog().setCanceledOnTouchOutside(false);
                mRouter.selectRouteInt(mRouteTypes, mEditingGroup);
                update(); 
                scrollToEditingGroup(); 
            } 
        } 
    } 
 
    class MediaRouterCallback extends MediaRouter.Callback {
        @Override 
        public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {
            mAdapter.update();
            updateVolume(); 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPresentationDisplay
 
    private void updatePresentation() { 
        // Get the current route and its presentation display. 
        MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(
                MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
        Display presentationDisplay = route != null ? route.getPresentationDisplay() : null;
 
        // Dismiss the current presentation if the display has changed. 
        if (mPresentation != null && mPresentation.getDisplay() != presentationDisplay) {
            Log.i(TAG, "Dismissing presentation because the current route no longer "
                    + "has a presentation display."); 
            mPresentation.dismiss();
            mPresentation = null;
        } 
 
        // Show a new presentation if needed. 
        if (mPresentation == null && presentationDisplay != null) {
            Log.i(TAG, "Showing presentation on display: " + presentationDisplay);
            mPresentation = new DemoPresentation(this, presentationDisplay);
            mPresentation.setOnDismissListener(mOnDismissListener);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getVolumeHandling, getVolumeMax, requestSetVolume
 
    void changeVolume(int newValue) {
        if (mIgnoreSliderVolumeChanges) return;
 
        final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
        if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
            final int maxVolume = selectedRoute.getVolumeMax();
            newValue = Math.max(0, Math.min(newValue, maxVolume));
            selectedRoute.requestSetVolume(newValue);
        } 
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        mInflater = inflater;
        final View layout = inflater.inflate(R.layout.media_route_chooser_layout, container, false);
 
        mVolumeIcon = (ImageView) layout.findViewById(R.id.volume_icon);
        mVolumeSlider = (SeekBar) layout.findViewById(R.id.volume_slider);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android MediaRouter.RouteInfo Questions & Answers:

See Code Examples for Android MediaRouter.RouteInfo Methods: