TourGuide icon indicating copy to clipboard operation
TourGuide copied to clipboard

Overlay not full screen in some devices

Open chhetrirahul opened this issue 6 years ago • 8 comments

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

chhetrirahul avatar Oct 09 '17 14:10 chhetrirahul

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! :)

cdecron avatar Nov 21 '17 21:11 cdecron

not working,can you show the sample code?

sunnyYang07 avatar Nov 27 '17 08:11 sunnyYang07

"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.

cdecron avatar Nov 27 '17 08:11 cdecron

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

sunnyYang07 avatar Nov 28 '17 10:11 sunnyYang07

You're welcome :)

cdecron avatar Nov 28 '17 11:11 cdecron

Thank you

youssefshamass avatar Apr 04 '18 11:04 youssefshamass

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.

carlos-mg89 avatar Nov 01 '21 12:11 carlos-mg89

@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

jackyhieu1211-hn avatar Nov 01 '21 13:11 jackyhieu1211-hn