Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay not full screen in some devices #114

Open
chhetrirahul opened this issue Oct 9, 2017 · 8 comments
Open

Overlay not full screen in some devices #114

chhetrirahul opened this issue Oct 9, 2017 · 8 comments

Comments

@chhetrirahul
Copy link

Overlay leaves some space at the bottom in devices with onscreen buttons in navigation bar. It is fine with device with physical button.

@cdecron
Copy link

cdecron commented Nov 21, 2017

I had this problem too, to solve it you need to download the TourGuide lib from here https://github.com/worker8/TourGuide/releases/tag/v1.0.17-SNAPSHOT and integrate it in your app, to be able to modify the lib code.
Then, create a new method like this:

public static Point getDefaultResolution(Activity activity) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
            display.getRealSize(size);
        else
            display.getSize(size);

        return size;
    }

It allows to get the "real" resolution of the device, including the soft buttons area if any.

Finally, each time TourGuide lib calls getResources().getDisplayMetrics().widthPixels or getResources().getDisplayMetrics().heightPixels, call the method above instead.

Solved! :)

@sunnyYang07
Copy link

not working,can you show the sample code?

@cdecron
Copy link

cdecron commented Nov 27, 2017

"Can you show the sample code please?"
I help you freely, I'm don't owe you anything, so please, be a bit kinder.

I wrote above the method to get the real screen resolution, including the soft buttons area.
What you just have to do is copy/paste this method, and call it each time TourGuide lib calls getResources().getDisplayMetrics().widthPixels or getResources().getDisplayMetrics().heightPixels.
This is called in getScreenWidth() method in TourGuide.java, and in init(AttributeSet attrs, int defStyle) method of FrameLayoutWithHole.java.

@sunnyYang07
Copy link

got it!
Thank you very mach!!!!!!

@cdecron
Copy link

cdecron commented Nov 28, 2017

You're welcome :)

@youssefshamass
Copy link

Thank you

@carlos-mg89
Copy link

carlos-mg89 commented Nov 1, 2021

Another way to deal with this issue, is to replace the official Gradle dependency of this project, which I had it like this:

implementation('com.github.worker8:tourguide:2.0.0-SNAPSHOT@aar') {
        transitive(true)
}

And replace it with the patched version from hieuseesaa:

implementation "com.github.hieuseesaa:tourguide:b00064a"

This way, you'll basically download the dependency from the Git fork of hieuseesaa (to the very commit that deals with this, so if the fork of hieuseesaa changes, it won't affect anything else).

We wouldn't have to do this if the maintainer of this wonderful Android library would accept the pull request from hieuseesaa.

@jackyhieu1211-hn
Copy link

@carlos-mg89
This library has no maintainers. so I recommend you to fix it yourself and create your own fork
Then Please visit jitpack.io to release version
jitpack is very easy to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants