androiddialogchromecastcastcompanionlibrary

How to change theme on Dialog Cast Companion Library android


I'm using Cast Companion Library android.

I want to change some color like text color, play, pause button to Dark. Right now is in Light color. Any suggestion to do this?

This is the screenshot image

Thanks


Solution

  • I'm adding some code on activity, from this link:

    http://explod.io/setting-the-theme-of-mediaroutechooserdialog/

        MediaRouteDialogFactory mMediaRouteDialogFactory = new VideoMediaRouteDialogFactory() {
    
        @NonNull
        @Override
        public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
            return new MediaRouteChooserDialogFragment() {
                @Override
                public MediaRouteChooserDialog onCreateChooserDialog(Context context, Bundle savedInstanceState) {
                    return new MediaRouteChooserDialog(context, android.R.style.Theme_Material_Light_Dialog);
                }
            };
        }
    };
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.my_menu, menu);
        mMediaRouteMenuItem = mCastManager.addMediaRouterButton(menu, R.id.media_route_menu_item);
        MenuItem routeItem = menu.findItem(R.id.media_route_menu_item);
        MediaRouteActionProvider mediaRouteButton = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(routeItem);
        mediaRouteButton.setDialogFactory(mMediaRouteDialogFactory);
        return true;
    }