Comments (11)
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.
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.
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.
Hey, thanks for your work. I shall have a look at it and see what I can do to fix it
from materialtaptargetprompt.
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.
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.
So only this without my changes?
from materialtaptargetprompt.
Currently without, yes
from materialtaptargetprompt.
@ElineDeMeyer did the changes that I suggested work for you?
from materialtaptargetprompt.
Yes, please include these or an improved solution in one of your next releases :)
from materialtaptargetprompt.
Thanks for your help, it is very much appreciated! The fix is released in v1.5.0
from materialtaptargetprompt.
Related Issues (20)
- Display multiple prompt target and go them step by step HOT 1
- Change opacity of background HOT 1
- NullPointerException at onAnimationEnd(MaterialTapTargetPrompt.java:529) on some devices running Android 6.0 HOT 1
- Bintray is closing any plans to publish somewher else? HOT 1
- java.lang.NullPointerException: at android.graphics.Typeface.create (Typeface.java:849) HOT 6
- JCenter shuts down in May HOT 4
- Crash on OnePlus IN2021: java.lang.NullPointerException: Attempt to read from field 'boolean android.graphics.Path.isSimplePath' on a null object reference HOT 1
- How to set target for Toolbar overflow menu HOT 1
- Jetpack Compose HOT 5
- How to adjust the spacing of secondary text lines? HOT 1
- 3.3.1 update causes text to render weirdly with alpha effected by view background HOT 4
- Please how I can use it for multiple buttons HOT 1
- Show on an android.app.Dialog HOT 8
- java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)'
- Localisation is not working in these promts.
- Sequence keep repeating in viewpager2
- The text is incorrectly positioned.
- Prompt not showing on dynamically created view
- How we can add multiple target on it. HOT 1
- Fatal Exception: java.lang.NullPointerException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialtaptargetprompt.