Forked from rharter/ThemeableMediaRouteActionProvider.java
          
        
    
          Last active
          August 29, 2015 14:18 
        
      - 
      
 - 
        
Save antslava/ee0a81d125bc8e67676c to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <resources> | |
| <declare-styleable name="ThemeableMediaRouteButton"> | |
| <!-- This drawable is a state list where the "checked" state | |
| indicates active media routing. Checkable indicates connecting | |
| and non-checked / non-checkable indicates | |
| that media is playing to the local device only. --> | |
| <attr name="routeEnabledDrawable" format="reference" /> | |
| <attr name="iconColor" format="reference|color" /> | |
| <attr name="android:minWidth" /> | |
| <attr name="android:minHeight" /> | |
| </declare-styleable> | |
| </resources> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <resources> | |
| <style name="Widget.MediaRouter.MediaRouteButton" parent="Widget.MediaRouter.Light.MediaRouteButton"> | |
| <item name="routeEnabledDrawable">@drawable/ic_chrome_media_route</item> | |
| <item name="iconColor">@color/red</item> | |
| </style> | |
| <style name="Widget.MediaRouter.MediaRouteButton.Section1"> | |
| <item name="iconColor">@color/white</item> | |
| </style> | |
| <style name="Widget.MediaRouter.MediaRouteButton.Section2"> | |
| <item name="iconColor">@color/blue</item> | |
| </style> | |
| </resources> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package com.ryanharter.mediaroute.widgets; | |
| import android.content.Context; | |
| import android.support.v7.app.MediaRouteActionProvider; | |
| import android.support.v7.app.MediaRouteButton; | |
| /** | |
| * A MediaRouteActionProvider that allows the use of a ThemeableMediaRouteButton. | |
| */ | |
| public class ThemeableMediaRouteActionProvider extends MediaRouteActionProvider { | |
| public ThemeableMediaRouteActionProvider(Context context) { | |
| super(context); | |
| } | |
| @Override public MediaRouteButton onCreateMediaRouteButton() { | |
| return new ThemeableMediaRouteButton(getContext()); | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <resources> | |
| <style name="Theme.MyApp"> | |
| <item name="mediaRouteButtonStyle">@style/Widget.MediaRouter.MediaRouteButton</item> | |
| </style> | |
| <style name="Theme.MyApp.Section1"> | |
| <item name="mediaRouteButtonStyle">@style/Widget.MediaRouter.MediaRouteButton.Section1</item> | |
| </style> | |
| <style name="Theme.MyApp.Section2"> | |
| <item name="mediaRouteButtonStyle">@style/Widget.MediaRouter.MediaRouteButton.Section2</item> | |
| </style> | |
| </resources> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment