0

I'm creating a cast-enabled application using the CastVideos-android sample project as a reference.

Version 1.2 of the CastVideos-android sample uses this forked version of the ShowcaseView library to display a very nice looking overlay to highlight the cast button.

This is great and helps developers satisfy the Cast Sender-App UI requirements, but this forked version of the ShowcaseView library doesn't play well with apps that may use multiple icons in the ActionBar.

For example, when adding a SearchView-type item to the ActionBar the ShowcaseView bugs-out.

The result is below and the steps to replicate this behavior are below the screenshot :

enter image description here

Steps to replicate:

  1. Include the v7-appcompat as a library project in the CastVideo-android project.
  2. Change the res/menu/main.xml in the CastVideo-android project to look like the following (adding an ActionView of type SearchView to the ActionBar) :

    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:compat="http://schemas.android.com/apk/lib/res/android.support.v7.appcompat" >
    
        <item
            android:id="@+id/media_route_menu_item"
            android:title="@string/media_route_menu_title"
            app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
            app:showAsAction="always"/>
    
        <item
            android:id="@+id/action_settings"
            android:title="@string/action_settings"
            app:showAsAction="never"/>
    
        <item
            android:id="@+id/search"
            android:icon="@drawable/abc_ic_search"
            app:title="@string/menu_Search"
            app:actionViewClass="android.support.v7.widget.SearchView"
            app:showAsAction="collapseActionView|ifRoom"/>
    
    </menu>
    

I'm using the latest version of the v7-appcompat library.

I suspect the culprit to be how the ActionBarViewWrapper.getMediaRouterButtonView() method (found in com.github.amlcurran.showcaseview.targets) is finding the MediaRouterButton via reflection, but can't seem to understand how to find the MediaRouterButton if there are multiple icons items in the ActionBar.

Any help would be greatly appreciated!

dell116
  • 5,835
  • 9
  • 52
  • 70
  • If you remove the search view, does it work? I want to make sure it is caused by adding a search view. Also, to help narrowing down the issue, can you add a normal action item there (not a view) and see if that works? – Ali Naddaf Aug 14 '14 at 20:58
  • Thanks for the quick reply, Ali. Actually, the only way I can get this to work properly is if the Cast icon is the *only* icon in the ActionBar. If I put an additional regular menu item up there (non-overflow so there are now 2 icons) the issue remains. It seems the issue is *not* specific to ActionView-type items in the ActionBar, but rather when there is more than 1 icon in the ActionBar other than the Cast icon. – dell116 Aug 14 '14 at 21:21
  • I did that fork so I need to find a bit of time to look into that; that fork, by the way, is merged up the stream now. Feel free to open a bug on the forked project and as soon as I get a chance, I will take a look; the case that I focused on was the CastVideos app and that had only one action item. – Ali Naddaf Aug 14 '14 at 21:24
  • I'll file the bug in the forked project and look into an alternate way of showcasing the Cast icon for now. If I find a solution I'll post the answer here. Thanks! – dell116 Aug 14 '14 at 21:42
  • Please do file the bug! Ill take a look next week – Alex Curran Aug 15 '14 at 05:56
  • I have a new AAR for you to test, please grab ShowCaseLibrary.aar from here: https://drive.google.com/file/d/0B3NDT1QDrrDmc2ZhdUFiYlROU3c/edit?usp=sharing and test that in your project (make sure you use this AAR and not the ShowCaseview project directly). @AlexCurran: Alex, if that works, I will submit a pull request to handle this case as well. – Ali Naddaf Aug 15 '14 at 07:33
  • @AlexCurran: Pull request has been submitted, thx – Ali Naddaf Aug 16 '14 at 17:20

1 Answers1

0

The forked project has been updated to handle this case. Thanks for reporting the issue. Once I hear from you (or anyone else) that it works as expected, I will submit a pull request to Alex.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28