worker8 / TourGuide

TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View
MIT License
2.63k stars 416 forks source link

Overlay not full screen in some devices #114

Open chhetrirahul opened 6 years ago

chhetrirahul commented 6 years ago

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

cdecron commented 6 years ago

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 commented 6 years ago

not working,can you show the sample code?

cdecron commented 6 years ago

"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 commented 6 years ago

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

cdecron commented 6 years ago

You're welcome :)

youssefshamass commented 6 years ago

Thank you

carlos-mg89 commented 2 years ago

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 commented 2 years ago

@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