Search in sources :

Example 1 with MediaRouteActionProvider

use of android.support.v7.app.MediaRouteActionProvider in project cw-omnibus by commonsguy.

the class MainActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_actions, menu);
    rc = (ReverseChronometer) menu.findItem(R.id.countdown).getActionView();
    rc.setWarningDuration(5 * 60);
    rc.setOnClickListener(this);
    rc.setOnLongClickListener(this);
    rc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
    rc.setTextColor(Color.WHITE);
    if (durationInSeconds > 0) {
        rc.setOverallDuration(durationInSeconds);
    }
    MenuItem item = menu.findItem(R.id.route_provider);
    MediaRouteActionProvider provider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(item);
    provider.setRouteSelector(selector);
    return (super.onCreateOptionsMenu(menu));
}
Also used : MediaRouteActionProvider(android.support.v7.app.MediaRouteActionProvider) MenuItem(android.view.MenuItem)

Example 2 with MediaRouteActionProvider

use of android.support.v7.app.MediaRouteActionProvider in project zype-android by zype.

the class BaseCastManager method addMediaRouterButton.

/**
 * Adds and wires up the Media Router cast button. It returns a reference to the Media Router
 * menu item if the caller needs such reference. It is assumed that the enclosing
 * {@link android.app.Activity} inherits (directly or indirectly) from
 * {@link android.support.v7.app.ActionBarActivity}.
 *
 * @param menu Menu reference
 * @param menuResourceId The resource id of the cast button in the xml menu descriptor file
 */
public final MenuItem addMediaRouterButton(Menu menu, int menuResourceId) {
    MenuItem mediaRouteMenuItem = menu.findItem(menuResourceId);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    if (getMediaRouteDialogFactory() != null) {
        mediaRouteActionProvider.setDialogFactory(getMediaRouteDialogFactory());
    }
    return mediaRouteMenuItem;
}
Also used : MediaRouteActionProvider(android.support.v7.app.MediaRouteActionProvider) MenuItem(android.view.MenuItem)

Example 3 with MediaRouteActionProvider

use of android.support.v7.app.MediaRouteActionProvider in project Shuttle by timusus.

the class BaseCastManager method addMediaRouterButton.

/**
 * Adds and wires up the Media Router cast button. It returns a reference to the Media Router
 * menu item if the caller needs such reference. It is assumed that the enclosing
 * {@link android.app.Activity} inherits (directly or indirectly) from
 * {@link android.support.v7.app.AppCompatActivity}.
 *
 * @param menu Menu reference
 * @param menuResourceId The resource id of the cast button in the xml menu descriptor file
 */
public final MenuItem addMediaRouterButton(Menu menu, int menuResourceId) {
    MenuItem mediaRouteMenuItem = menu.findItem(menuResourceId);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    if (getMediaRouteDialogFactory() != null) {
        mediaRouteActionProvider.setDialogFactory(getMediaRouteDialogFactory());
    }
    return mediaRouteMenuItem;
}
Also used : MediaRouteActionProvider(android.support.v7.app.MediaRouteActionProvider) MenuItem(android.view.MenuItem)

Example 4 with MediaRouteActionProvider

use of android.support.v7.app.MediaRouteActionProvider in project cw-omnibus by commonsguy.

the class PlaybackFragment method onCreateOptionsMenu.

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    this.menu = menu;
    inflater.inflate(R.menu.main, menu);
    updateMenu();
    MenuItem item = menu.findItem(R.id.route_provider);
    MediaRouteActionProvider provider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(item);
    provider.setRouteSelector(selector);
}
Also used : MediaRouteActionProvider(android.support.v7.app.MediaRouteActionProvider) MenuItem(android.view.MenuItem)

Example 5 with MediaRouteActionProvider

use of android.support.v7.app.MediaRouteActionProvider in project cw-omnibus by commonsguy.

the class MainActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    MenuItem item = menu.findItem(R.id.route_provider);
    MediaRouteActionProvider provider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(item);
    provider.setRouteSelector(selector);
    return (true);
}
Also used : MediaRouteActionProvider(android.support.v7.app.MediaRouteActionProvider) MenuItem(android.view.MenuItem)

Aggregations

MediaRouteActionProvider (android.support.v7.app.MediaRouteActionProvider)9 MenuItem (android.view.MenuItem)9