deano2390 / MaterialShowcaseView

A Material Design themed ShowcaseView for Android
Apache License 2.0
2.72k stars 526 forks source link

Allows user to set a custom gravity for content box. #117

Closed noordawod closed 5 years ago

noordawod commented 7 years ago

If that happens, automatic gravity calculation will be ignored.

noordawod commented 7 years ago

@deano2390 is this project active?

CapnSpellcheck commented 7 years ago

I tried this out as I was building an über version. I didn't like how the margins were set to 0, here's the changes I preferred in setTarget:

            // If there's no custom gravity in place, we'll do automatic gravity calculation.
            if (!mHasCustomGravity) {
                if (yPos >= midPoint) {
                    // target is in lower half of screen, we'll sit above it
                    mGravity = Gravity.BOTTOM;
                } else {
                    // target is in upper half of screen, we'll sit below it
                    mGravity = Gravity.TOP;
                }
            }
            if (mGravity == Gravity.TOP) {
                mContentTopMargin = yPos + radius + mShapePadding;
                mContentBottomMargin = 0;
            } else {
                mContentTopMargin = 0;
                mContentBottomMargin = (height - yPos) + radius + mShapePadding;
            }
deano2390 commented 5 years ago

i'm so sorry for not responding, I'm just so busy I don't have the time to maintain this project at all. I have invited you as a collaborator if you want to merge your changes in.

noordawod commented 5 years ago

Merged pull into master, thanks @deano2390.

@CapnSpellcheck can you please send a new pr?

CapnSpellcheck commented 5 years ago

What's going on here? Unfortunately I did not create a proper fork here, but pulled the source in as a module to my project (this was at a time when I was being very lazy). So I don't think I was the source of the PR but just gave the snippet above.....