amlcurran / ShowcaseView

[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
5.6k stars 1.29k forks source link

ShowcaseView with Dialogs #327

Closed Burtan closed 8 years ago

Burtan commented 8 years ago

Hi, I'm having problems using ShowcaseView with dialogs. I know there is an old closed issue: https://github.com/amlcurran/ShowcaseView/issues/139 But the workaround described on StackOverflow does not work (anymore). http://stackoverflow.com/questions/23896656/showcaseview-on-top-of-dialogfragment

Without having deep knowledge about the window managing of android, I guess the problem is that ShowcaseView is always drawn on the window of the activity passed to the builder. But a dialog creates its own window which is drawn on top of the activites window. Thus, without changing the window, on which ShowcaseView is drawn, you will never get it on top of the dialog. Maybe there are some cheeky tricks to play with window options?

Burtan commented 8 years ago

I was actually doing the old workaround wrong, but still it is not feasible. The point was to use

    getChildFragmentManager()
            .beginTransaction()
            .add(R.id.topLayout, dialogFragment, "Some_tag")
            .commit();

instead of

    FragmentManager fm = getChildFragmentManager();
    dialogFragment.show(fm, "tag");

But this messes the whole dialog. You don't get any window decoration anymore (like borders) and you can't use any dialog method anymore like

setTitle("title")
Burtan commented 8 years ago

The best workaround for now is to use a ShowcaseView without target and remove the background dim of the dialogfragment:

getDialog().getWindow().setDimAmount(0);

This way, you have your ShowcaseView as the normal background and the whole dialog is highlighted. To get a better result, I think we have to create a new builder, which takes the dialog instead of the activity.

amlcurran commented 8 years ago

Are you using 5.3.0 or above? Do dialogs work using the useDecorViewAsParent()) detailed in the changed behaviour section of that release ([https://github.com/amlcurran/ShowcaseView/releases/tag/5.3.0]())

Toxidious87 commented 8 years ago

Using useDecorViewAsParent() does not fix the problem. Only thing which is changing is that the button overlays the softkeys of my smartphone.. The Showcase is still located behind the dialog.

amlcurran commented 8 years ago

So I had a quick go, it doesn't look like it will be possible. This is what happens when I use the window that the dialog provides (as @Burtan said, Dialog's have their own Window):

screen shot 2016-04-06 at 21 46 55

So I'm marking this as will not fix. Sorry guys!