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

Updated to newer gradle / SDK 21 - the demo app 2nd image wrapping above #10

Open
RoundSparrow opened this issue Dec 2, 2014 · 2 comments

Comments

@RoundSparrow
Copy link

Hello. I updated everything to SDK 21. Sorry I stripped out some of the maven upload stuff in name of getting it to compile. There has been rework of the syntax/etc that I didn't have time to learn. Fork here: https://github.com/RoundSparrow/FlowTextView

The problem I see: your screen shot shows text above the right image, the second image. However, my build is not dong this - it is leaving the space above the right image as blank.

Any ideas on changes in the SDK or such that we might be able to adjust for?

@RoundSparrow
Copy link
Author

FlowTextView.java line 251 looks like trouble to me. Is there a stray plus sign on that line?

@RoundSparrow
Copy link
Author

I came up with this:

public boolean useTopMarginWorkaround = true;

/*
Additions / tweaking author: Stephen A. Gutknecht
 */
private int findBoxesAndReturnLowestObstacleYCoord() {
    int lowestYCoord = 0;
    int childCount = this.getChildCount();
    LayoutParams layoutParams;
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() != View.GONE) {
            layoutParams = (LayoutParams) child.getLayoutParams();
            Obstacle obstacle = new Obstacle();
            obstacle.topLeftx = child.getLeft() - layoutParams.leftMargin;

            if (useTopMarginWorkaround)
                obstacle.topLefty = child.getTop();
            else
                obstacle.topLefty = child.getTop() - layoutParams.topMargin;

            obstacle.bottomRightx = obstacle.topLeftx + layoutParams.leftMargin + child.getWidth() + layoutParams.rightMargin;       // padding should probably be included as well
            if (useTopMarginWorkaround)
                obstacle.bottomRighty = child.getBottom();  // padding should probably be included as well
            else
                obstacle.bottomRighty = obstacle.topLefty + layoutParams.topMargin + child.getHeight() + layoutParams.bottomMargin;  // padding should probably be included as well

            android.util.Log.d("FTV2", "Create Obstacle " + i + "/" + (childCount - 1) + " " + obstacle.toString() + " !! CT " + child.getTop() + " CTM " + layoutParams.topMargin);
            obstacles.add(obstacle);
            if (obstacle.bottomRighty > lowestYCoord) lowestYCoord = obstacle.bottomRighty;
        }
    }

    return lowestYCoord;
}

Can someone help confirm they see the difference if you flip useTopMarginWorkaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant