Coder Social home page Coder Social logo

Comments (11)

sjwall avatar sjwall commented on May 16, 2024

Hi, it sounds like the prompt should be checking if the view has enough height to display the text above (or below) the target and if it doesn't then display the text it to the side. The other option is to add functionality to disable clipping to the activity bounds so that it could draw outside the activity bounds.

Let me know how you get on searching for a solution. I shall look at expanding the dialog functionality in the sample app to cover having the dialog in different positions and sizes.

from materialtaptargetprompt.

ElineDeMeyer avatar ElineDeMeyer commented on May 16, 2024

Its ok to draw the prompt inside the bounds. I'm perfectly happy with the prompt. It is only shown in the activity bounds. Just the text is not there.

I think if he knew the parent is not full screen parent decorview but is a coordinatorlayout smaller than the screen, it should be fine.

from materialtaptargetprompt.

ElineDeMeyer avatar ElineDeMeyer commented on May 16, 2024

Changes I did:

  • in getParentView() where you check if the contentView is a drawer layout, I added comparing the size of the contentView with the one of the decorView in that way we pass the contentView when the activity is not full screen:
if (contentView.getClass().getName().equals("android.support.v4.widget.DrawerLayout")
                    || contentView.getHeight() != decorView.getHeight()
                    || contentView.getWidth() != decorView.getWidth())
  • in updateTextPositioning() when calculating mView.mPrimaryTextTop I added in both cases the getParentView().getTop(). This will be 0 for full screen activity and otherwise we get the position of the text relative to the screen boundaries
mView.mPrimaryTextTop = mView.mCentreTop;
        if (mTextPositionAbove)
        {
            mView.mPrimaryTextTop = mView.mPrimaryTextTop - mBaseFocalRadius - mFocalToTextPadding - mView.mPrimaryTextLayout.getHeight() + getParentView().getTop();
        }
        else
        {
            mView.mPrimaryTextTop += mBaseFocalRadius + mFocalToTextPadding + getParentView().getTop();
        }

1 problem left:
after calculating everything and ready to show, I get an onGlobalLayout event and updateFocalCentrePosition is called again but now it sais that my FAB is top right of my screen and my coordinatorLayout is 2272x1672 instead of the dialogActivity coordinatorLayout that should be 800x780
to test I added android:layout_gravity="center_horizontal|bottom" to the CoordinatorLayout and android:layout_gravity="bottom|end" to the FAB in the activity_dialog_style.xml.

Any idea?

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

Hey, thanks for your work. I shall have a look at it and see what I can do to fix it

from materialtaptargetprompt.

ElineDeMeyer avatar ElineDeMeyer commented on May 16, 2024

Debugged a little further and I saw that the mClipToView when having the onGlobalLayout has a different left and top (left: 64 iso 510 and top: 64 iso 1536). It's then used to update everything and the activity is now larger and almost full screen. mClipToView is still the same mClipToView as before (according to my watches in Android Studio). No idea why it changed yet...

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

Still need to do some more testing but changing the text positioning at the end of updateFocalCentrePosition() fixes it for me:

mTextPositionAbove = mView.mCentreTop > mView.mClipBoundsTop + ((mView.mClipBoundsBottom - mView.mClipBoundsTop) / 2);
mTextPositionRight = mView.mCentreLeft > mView.mClipBoundsLeft + ((mView.mClipBoundsRight - mView.mClipBoundsLeft) / 2);

I think this can (and should) be improved further so that it can position the text better when there is limited room

from materialtaptargetprompt.

ElineDeMeyer avatar ElineDeMeyer commented on May 16, 2024

So only this without my changes?

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

Currently without, yes

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

@ElineDeMeyer did the changes that I suggested work for you?

from materialtaptargetprompt.

ElineDeMeyer avatar ElineDeMeyer commented on May 16, 2024

Yes, please include these or an improved solution in one of your next releases :)

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

Thanks for your help, it is very much appreciated! The fix is released in v1.5.0

from materialtaptargetprompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.