Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different device size issue #43

Closed
MahdiTaghipour opened this issue Feb 13, 2017 · 14 comments
Closed

different device size issue #43

MahdiTaghipour opened this issue Feb 13, 2017 · 14 comments
Milestone

Comments

@MahdiTaghipour
Copy link

Hi,
I have problem using this library with different screen sizes. on a 7" tablet, the texts falls outside the box from left or right, while there is no problem with a 5.7" device. How can i handle this issue. i have to mention that,this occurs rarely and only some text in some positions behave in this manner.
thanks in advance.

@sjwall
Copy link
Owner

sjwall commented Feb 14, 2017

Probably related to #41 please try v1.9.1 and let me know if it fixes it for you

@sjwall sjwall closed this as completed Feb 18, 2017
@MahdiTaghipour
Copy link
Author

no it is not fixed in the new version.

@sjwall
Copy link
Owner

sjwall commented Feb 21, 2017

Could you please provide the Android version that this is effecting and the target position on screen, so that I can investigate further. Thanks

@MahdiTaghipour
Copy link
Author

I see this issue on a 7" tablet with android version of 17.
my app is multilingual and the problem occurs in persian(farsi) language. I think it is some thing related to language of app.
0dc137291f-58ac3d1bc2fbb865b58b5273

@sjwall sjwall reopened this Feb 22, 2017
@amalkh5
Copy link

amalkh5 commented Feb 26, 2017

Also, i get this problem in Nexus 6p
my Langage is Arabic

@sjwall
Copy link
Owner

sjwall commented Feb 26, 2017

The fix for this has been released in v1.9.3. If you are still having issues please reopen this bug. Thanks

@sjwall sjwall closed this as completed Feb 26, 2017
@sjwall sjwall added this to the v1.9.3 milestone Feb 26, 2017
@amalkh5
Copy link

amalkh5 commented Feb 26, 2017

yes I still get this problem also in different device screen sizes like 9 and 5

@sjwall
Copy link
Owner

sjwall commented Feb 26, 2017

It looks like it is an issue with detecting how long the text is with different language alphabets,

@sjwall sjwall reopened this Feb 26, 2017
@MahdiTaghipour
Copy link
Author

The problem remains in new version.
e6b1fe9e16-58b50f99c2fbb8f7a68b5cd8

sjwall added a commit that referenced this issue Mar 28, 2017
Fixed right to left text positioning #43
sjwall added a commit that referenced this issue Mar 28, 2017
sjwall added a commit that referenced this issue Apr 2, 2017
@sjwall
Copy link
Owner

sjwall commented Apr 2, 2017

Changes made in release v1.9.4 should fix this issue. If not please reopen. Thanks

@sjwall sjwall closed this as completed Apr 2, 2017
@FrangSierra
Copy link
Contributor

Sadly im having this problem on one of my devices. Texts from left to right are falling outside the view. It just happend in an specific case.

screenshot_20180504-220844

I'm using the library from Kotlin, but I think that it should no affect it.

    private fun createDefaultStyleMaterialTarget(title: String, content: String, view: View, activity: Activity, onClick: () -> Unit = {}) =
            MaterialTapTargetPrompt.Builder(activity)
                    .setAnimationInterpolator(FastOutSlowInInterpolator())
                    .setPrimaryTextColour(activity.color(R.color.color_accent))
                    .setSecondaryTextSize(activity.resources.getDimension(R.dimen.default_tutorial_text_size))
                    .setFocalColour(activity.color(R.color.color_app_grey))
                    .setBackgroundColour(activity.color(R.color.tutorial_background_black))
                    .setSecondaryText(content)
                    .setPrimaryText(title)
                    .setPromptBackground(CustomCirclePromptBackground())
                    .setCaptureTouchEventOnFocal(true)
                    .setCaptureTouchEventOutsidePrompt(true)
                    .setMaxTextWidth(R.dimen.tap_target_menu_max_width)
                    .setPromptStateChangeListener { _, state ->
                        if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED || state == STATE_NON_FOCAL_PRESSED) {
                            onClick()
                        }
                    }
                    .setTarget(view)

I have follow the error to the CirclePromptBackground to line 131. Where it should calculate the length based on the textBounds and the focalBounds. At this position the focalBounds is bigger than the textBounds(when it shouldn't).

If I reverse this if clase this case works, but ofc i broke the rest of my implementations with the library 😅 . I'm gonna try to fix it and upload a PR to the library, but my knowledge about custom views is not so great.

Hope that you will fix it soon! Your library is amazing! Thank you mate

@FrangSierra
Copy link
Contributor

Opened a PR that fix the problem making easier and safer the way that the CirclePromptBackground measures the right length
#116

@sjwall
Copy link
Owner

sjwall commented May 14, 2018

I have found an issue when the target is wider that the text size it is calculating the size incorrectly but it doesn't explain what you are seeing, looking into it

@sjwall sjwall reopened this May 14, 2018
@sjwall
Copy link
Owner

sjwall commented May 19, 2018

The changes have been released in v2.9.0.
If the issue persists please reopen and provide the following:

  • screen bounds(left, top, right, bottom) clipBounds
  • focal bounds(left, top, right, bottom) focalBounds
  • focal padding focalPadding
  • text bounds(left, top, right, bottom) textBounds
  • text padding textPadding

These can be obtained by putting a break point on line 113 in CirclePromptBackground.java

With these values I can put them in the tool I have created here to figure out exactly how the calculations are being made

Thanks

@sjwall sjwall closed this as completed May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants