Java Code Examples for android.support.v7.media.MediaRouter.RouteInfo#isConnecting()

The following examples show how to use android.support.v7.media.MediaRouter.RouteInfo#isConnecting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractMediaRouteController.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onRouteChanged(MediaRouter router, RouteInfo route) {
    // We only care about changes to the current route.
    if (!route.equals(getCurrentRoute())) return;
    // When there is no wifi connection, this condition becomes true.
    if (route.isConnecting()) {
        // We don't want to post the same Runnable twice.
        if (!mConnectionFailureNotifierQueued) {
            mConnectionFailureNotifierQueued = true;
            getHandler().postDelayed(mConnectionFailureNotifier,
                    CONNECTION_FAILURE_NOTIFICATION_DELAY_MS);
        }
    } else {
        // Only cancel the disconnect if we already posted the message. We can get into this
        // situation if we swap the current route provider (for example, switching to a YT
        // video while casting a non-YT video).
        if (mConnectionFailureNotifierQueued) {
            // We have reconnected, cancel the delayed disconnect.
            getHandler().removeCallbacks(mConnectionFailureNotifier);
            mConnectionFailureNotifierQueued = false;
        }
    }
}
 
Example 2
Source File: AbstractMediaRouteController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onRouteChanged(MediaRouter router, RouteInfo route) {
    // We only care about changes to the current route.
    if (!route.equals(getCurrentRoute())) return;
    // When there is no wifi connection, this condition becomes true.
    if (route.isConnecting()) {
        // We don't want to post the same Runnable twice.
        if (!mConnectionFailureNotifierQueued) {
            mConnectionFailureNotifierQueued = true;
            getHandler().postDelayed(mConnectionFailureNotifier,
                    CONNECTION_FAILURE_NOTIFICATION_DELAY_MS);
        }
    } else {
        // Only cancel the disconnect if we already posted the message. We can get into this
        // situation if we swap the current route provider (for example, switching to a YT
        // video while casting a non-YT video).
        if (mConnectionFailureNotifierQueued) {
            // We have reconnected, cancel the delayed disconnect.
            getHandler().removeCallbacks(mConnectionFailureNotifier);
            mConnectionFailureNotifierQueued = false;
        }
    }
}
 
Example 3
Source File: AbstractMediaRouteController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onRouteChanged(MediaRouter router, RouteInfo route) {
    // We only care about changes to the current route.
    if (!route.equals(getCurrentRoute())) return;
    // When there is no wifi connection, this condition becomes true.
    if (route.isConnecting()) {
        // We don't want to post the same Runnable twice.
        if (!mConnectionFailureNotifierQueued) {
            mConnectionFailureNotifierQueued = true;
            getHandler().postDelayed(mConnectionFailureNotifier,
                    CONNECTION_FAILURE_NOTIFICATION_DELAY_MS);
        }
    } else {
        // Only cancel the disconnect if we already posted the message. We can get into this
        // situation if we swap the current route provider (for example, switching to a YT
        // video while casting a non-YT video).
        if (mConnectionFailureNotifierQueued) {
            // We have reconnected, cancel the delayed disconnect.
            getHandler().removeCallbacks(mConnectionFailureNotifier);
            mConnectionFailureNotifierQueued = false;
        }
    }
}