android - Custom Cast Button and Behavior Implementation -
Does anyone know if it is possible to use custom ImageButton cast icons, and add MediaRouteActionProvider to repeat the behavior on a
ActionProvider this
ImageButton ?
In my application, I am using ActionBarSherlock with a split
actionbars , so I use MediaRouteActionProvider (at least according to my knowledge) Can not use Media Rotor V7 support in the library because it will push many of my items in the hyperbolic menu.
In other words how can I hook up the functionality of MediaRouteActionProvider without using
MenuItem without using
and
ImageButton < / P>
Any help or consideration would be appreciated!
Update
This can be easily done by adding MediaRouteButton to the XML and by adding the selector on the button.
Then my implementation is like this:
Create a mediaRouteButton via xml:
& lt; android.support.v7.app.MediaRouteButton android: id = "@ + id / media_route_button" Android: layout_height = "wrap_content" Android: layout_width = "wrap_content" /> Then create a MediaRouteSelector when you want to use it Note: CHROME_CAST, when you register your application on
the Developer Console The ID generated by
and attach the selector to your button using the setroutselector () method
MediaReferenceControl m_mediaRouteSelector = New MediaRouteSelector.Builder () .addControlCategory (MediaControlIntent.CATEGARY_REMOTE_PLAYBACK) .addControlCategory (CastMediaControlIntent.categoryForCast (CHROME_CAST)) .build (); MediaRoot Button M_Media RobotButton = (MediaRoot Button) Find VibibIID (RDDMDI_out_button); Then just do it:
m_mediaroute batton. Certifier Selector (m_mediaRouteSelector); Important for people with ActionBarSherlock * Note that it wants to create your own class to work with ActionBarSherlock MediaRouteButton Broad and especially do the following
@ Override public boolean showDialog () {/ ** Make all logic to find routes and show an AlertDialog where you call * To show the list of available routes on SetView (see V) * To use the built buttons you need to use a base class which is * FragmentActivity * / return true; }
In my application I use ActionBarSherlock with a different actionbar So, I can not use MediaRouteActionProvider (at least for my knowledge) in the built-in Google Cast SDK.
MediaRouteActionProvider in the appcompat_v7 library project, not Cast SDK.
You can do the same thing that works with ActionBarSherlock, at least in principle. I do not know the reason why this will not work - if it works with native action bar and EpicPantVision backport, then it should work for ActionBarSherlock.
Comments
Post a Comment